workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
not 31
2018-03-14T03:56:07.000311
Verline
pythondev_help_Verline_2018-03-14T03:56:07.000311
1,520,999,767.000311
38,724
pythondev
help
it would not
2018-03-14T03:56:21.000061
Micki
pythondev_help_Micki_2018-03-14T03:56:21.000061
1,520,999,781.000061
38,725
pythondev
help
that will throw an error I believe
2018-03-14T03:56:27.000196
Micki
pythondev_help_Micki_2018-03-14T03:56:27.000196
1,520,999,787.000196
38,726
pythondev
help
(assuming python3)
2018-03-14T03:56:38.000310
Micki
pythondev_help_Micki_2018-03-14T03:56:38.000310
1,520,999,798.00031
38,727
pythondev
help
not if you strip all non numericals
2018-03-14T03:56:38.000378
Verline
pythondev_help_Verline_2018-03-14T03:56:38.000378
1,520,999,798.000378
38,728
pythondev
help
ah yeah sure
2018-03-14T03:56:49.000192
Micki
pythondev_help_Micki_2018-03-14T03:56:49.000192
1,520,999,809.000192
38,729
pythondev
help
but your float would still not catch it
2018-03-14T03:57:22.000144
Micki
pythondev_help_Micki_2018-03-14T03:57:22.000144
1,520,999,842.000144
38,730
pythondev
help
Does this look good ?`int( float( re.sub( r'[^0-9.]', '', input ) ) )` with something like `input = '100.7px'`
2018-03-14T03:58:47.000183
Steffanie
pythondev_help_Steffanie_2018-03-14T03:58:47.000183
1,520,999,927.000183
38,731
pythondev
help
looks good to me, but i always have trouble remembering regex rules
2018-03-14T03:59:44.000356
Verline
pythondev_help_Verline_2018-03-14T03:59:44.000356
1,520,999,984.000356
38,732
pythondev
help
i think `int(float(100.7))` just rounds rather than causes an exception
2018-03-14T04:00:46.000377
Verline
pythondev_help_Verline_2018-03-14T04:00:46.000377
1,521,000,046.000377
38,733
pythondev
help
apparently it floors
2018-03-14T04:01:15.000121
Verline
pythondev_help_Verline_2018-03-14T04:01:15.000121
1,521,000,075.000121
38,734
pythondev
help
just checked
2018-03-14T04:01:18.000169
Verline
pythondev_help_Verline_2018-03-14T04:01:18.000169
1,521,000,078.000169
38,735
pythondev
help
:thumbsup: thanks
2018-03-14T04:01:28.000129
Micki
pythondev_help_Micki_2018-03-14T04:01:28.000129
1,521,000,088.000129
38,736
pythondev
help
```Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> int(float(100.7)) 100 ```
2018-03-14T04:01:36.000275
Verline
pythondev_help_Verline_2018-03-14T04:01:36.000275
1,521,000,096.000275
38,737
pythondev
help
yeah looks good at <@Steffanie>
2018-03-14T04:01:41.000155
Micki
pythondev_help_Micki_2018-03-14T04:01:41.000155
1,521,000,101.000155
38,738
pythondev
help
100 is better than 1007.
2018-03-14T04:01:45.000429
Steffanie
pythondev_help_Steffanie_2018-03-14T04:01:45.000429
1,521,000,105.000429
38,739
pythondev
help
```&gt;&gt;&gt; import re &gt;&gt;&gt; input = '100.7px' &gt;&gt;&gt; int( float( re.sub( r'[^0-9.]', '', input ) ) ) 100 ```
2018-03-14T04:02:21.000108
Verline
pythondev_help_Verline_2018-03-14T04:02:21.000108
1,521,000,141.000108
38,740
pythondev
help
I suppose an alternative is `int( float( re.sub( r'[^0-9.]', '', input ) ) + 0.5 )`.
2018-03-14T04:02:21.000284
Steffanie
pythondev_help_Steffanie_2018-03-14T04:02:21.000284
1,521,000,141.000284
38,741
pythondev
help
I think `round` convert to int and round
2018-03-14T04:02:33.000054
Micki
pythondev_help_Micki_2018-03-14T04:02:33.000054
1,521,000,153.000054
38,742
pythondev
help
if you want to get `101`
2018-03-14T04:02:46.000402
Micki
pythondev_help_Micki_2018-03-14T04:02:46.000402
1,521,000,166.000402
38,743
pythondev
help
that + 0.5 is ... you just fixed it
2018-03-14T04:03:01.000261
Verline
pythondev_help_Verline_2018-03-14T04:03:01.000261
1,521,000,181.000261
38,744
pythondev
help
`round( float( re.sub( r'[^0-9.]', '', input ) ) )` is a little more concise than adding 0.5.
2018-03-14T04:03:52.000192
Steffanie
pythondev_help_Steffanie_2018-03-14T04:03:52.000192
1,521,000,232.000192
38,745
pythondev
help
Thank you much!
2018-03-14T04:04:04.000302
Steffanie
pythondev_help_Steffanie_2018-03-14T04:04:04.000302
1,521,000,244.000302
38,746
pythondev
help
if you want to get really tricky, you could make it so it only matches one decimal point character
2018-03-14T04:04:25.000118
Verline
pythondev_help_Verline_2018-03-14T04:04:25.000118
1,521,000,265.000118
38,747
pythondev
help
but i probably would just catch the error and call it invalid input
2018-03-14T04:04:56.000155
Verline
pythondev_help_Verline_2018-03-14T04:04:56.000155
1,521,000,296.000155
38,748
pythondev
help
`float( '100..7' )` fails, so it is invalid input. That works for me.
2018-03-14T04:06:36.000309
Steffanie
pythondev_help_Steffanie_2018-03-14T04:06:36.000309
1,521,000,396.000309
38,749
pythondev
help
I'm running into a bit of an issue. Given a list of indices like `[6, 10, 17]` and a length, for example 19, I'm trying to generate a list which has an increasing number between each index. So 1 between the start and the first index, 2 between the first and second index, 3 between second and third and np.nan between th...
2018-03-14T05:49:55.000056
Faustino
pythondev_help_Faustino_2018-03-14T05:49:55.000056
1,521,006,595.000056
38,750
pythondev
help
<@Faustino> so you just don't like the for loop? I doubt there's anything that can help you, your use-case seems pretty unique
2018-03-14T05:55:16.000221
Aleida
pythondev_help_Aleida_2018-03-14T05:55:16.000221
1,521,006,916.000221
38,751
pythondev
help
could use list comprehension?
2018-03-14T06:00:03.000658
Terrence
pythondev_help_Terrence_2018-03-14T06:00:03.000658
1,521,007,203.000658
38,752
pythondev
help
hmm on second though the `current_number` may throw a spanner in the works
2018-03-14T06:01:26.000434
Terrence
pythondev_help_Terrence_2018-03-14T06:01:26.000434
1,521,007,286.000434
38,753
pythondev
help
<@Aleida> Basically, yes. I was optimizing a piece of code (where given a list like `[0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0]`) those numbers had to be assigned. I already managed to get a 25x performance increase by using masking and numpy, but now I'm just curious how to forego that for loop entirely.
2018-03-14T06:05:35.000171
Faustino
pythondev_help_Faustino_2018-03-14T06:05:35.000171
1,521,007,535.000171
38,754
pythondev
help
Well, if you transform your indices to lengths ("how many items I should add to the list") ``` position = 0 lengths = [] for index in indices: length = index - position position = index lengths.append(length) ``` the rest of algorithm becomes much more simpler ``` counter = 1 result = [] for length in lengths: ...
2018-03-14T06:11:02.000397
Aleida
pythondev_help_Aleida_2018-03-14T06:11:02.000397
1,521,007,862.000397
38,755
pythondev
help
ohh
2018-03-14T06:11:44.000265
Aleida
pythondev_help_Aleida_2018-03-14T06:11:44.000265
1,521,007,904.000265
38,756
pythondev
help
wait a sec
2018-03-14T06:11:46.000147
Aleida
pythondev_help_Aleida_2018-03-14T06:11:46.000147
1,521,007,906.000147
38,757
pythondev
help
Give me a sec and I'll post the full gist here
2018-03-14T06:11:57.000182
Faustino
pythondev_help_Faustino_2018-03-14T06:11:57.000182
1,521,007,917.000182
38,758
pythondev
help
You don't need a counter, enumerate FTW ``` result = [] for idx, length in enumerate(lengths, 1): result += [idx] * length result += [np.nan] * (total_length % len(result)) ```
2018-03-14T06:12:45.000539
Aleida
pythondev_help_Aleida_2018-03-14T06:12:45.000539
1,521,007,965.000539
38,759
pythondev
help
That's basically an mcve that shows what's going on.
2018-03-14T06:16:52.000366
Faustino
pythondev_help_Faustino_2018-03-14T06:16:52.000366
1,521,008,212.000366
38,760
pythondev
help
Copied an older version, I just updated it.
2018-03-14T06:17:44.000132
Faustino
pythondev_help_Faustino_2018-03-14T06:17:44.000132
1,521,008,264.000132
38,761
pythondev
help
Okay, so you need to understand snippets I showed you and adapt for your code (if you want to, of course, I think your code is perfectly fine)
2018-03-14T06:20:19.000114
Aleida
pythondev_help_Aleida_2018-03-14T06:20:19.000114
1,521,008,419.000114
38,762
pythondev
help
Yup, thanks for the support! The enumerate is a nice idea, and the lengths could probably be computed using `np.diff`. The only thing I'll have to check is whether appending to an array is faster than just inserting it straightaway.
2018-03-14T06:23:29.000135
Faustino
pythondev_help_Faustino_2018-03-14T06:23:29.000135
1,521,008,609.000135
38,763
pythondev
help
Sounds like a micro optimisation. You don't have billion items lists, so I doubt you'll see any measurable difference
2018-03-14T06:25:51.000213
Aleida
pythondev_help_Aleida_2018-03-14T06:25:51.000213
1,521,008,751.000213
38,764
pythondev
help
No, exactly, it's only a few hundred thousand per list. But it's just become somewhat of a fun personal challenge to basically get it as low as possible :wink:
2018-03-14T06:28:42.000014
Faustino
pythondev_help_Faustino_2018-03-14T06:28:42.000014
1,521,008,922.000014
38,765
pythondev
help
Use pypy and numpypy
2018-03-14T06:29:53.000270
Aleida
pythondev_help_Aleida_2018-03-14T06:29:53.000270
1,521,008,993.00027
38,766
pythondev
help
:slightly_smiling_face:
2018-03-14T06:29:55.000275
Aleida
pythondev_help_Aleida_2018-03-14T06:29:55.000275
1,521,008,995.000275
38,767
pythondev
help
Ooooh that's a good idea, thanks!
2018-03-14T06:30:31.000121
Faustino
pythondev_help_Faustino_2018-03-14T06:30:31.000121
1,521,009,031.000121
38,768
pythondev
help
you can also do a cython version and compare both :smile:
2018-03-14T06:31:31.000490
Micki
pythondev_help_Micki_2018-03-14T06:31:31.000490
1,521,009,091.00049
38,769
pythondev
help
Hey guys, could someone please help me out with pyspark? Have some questions about dataframe -&gt; libsvm conversion mostely and data limitations in libsmv and pyspark/spark respectively
2018-03-14T06:48:52.000170
Alyse
pythondev_help_Alyse_2018-03-14T06:48:52.000170
1,521,010,132.00017
38,770
pythondev
help
Probably best to just go ahead and ask - but you might also have more luck in <#C0JB9ATQV|data_science>
2018-03-14T07:00:58.000081
Zack
pythondev_help_Zack_2018-03-14T07:00:58.000081
1,521,010,858.000081
38,771
pythondev
help
It’s lower traffic, but it’s more likely to eventually get seen by somebody who knows there
2018-03-14T07:01:10.000081
Zack
pythondev_help_Zack_2018-03-14T07:01:10.000081
1,521,010,870.000081
38,772
pythondev
help
many thx!
2018-03-14T07:01:58.000296
Alyse
pythondev_help_Alyse_2018-03-14T07:01:58.000296
1,521,010,918.000296
38,773
pythondev
help
hi guys, I want use blod field in my Django project can i know that how to create blod filed in django my database id postgresql.I do not want use binay filed or field field
2018-03-14T07:10:21.000356
Vonda
pythondev_help_Vonda_2018-03-14T07:10:21.000356
1,521,011,421.000356
38,774
pythondev
help
<@Vonda> try asking in <#C0LMFRMB5|django> :slightly_smiling_face:
2018-03-14T08:03:15.000112
Micki
pythondev_help_Micki_2018-03-14T08:03:15.000112
1,521,014,595.000112
38,775
pythondev
help
:+1:
2018-03-14T08:03:51.000352
Vonda
pythondev_help_Vonda_2018-03-14T08:03:51.000352
1,521,014,631.000352
38,776
pythondev
help
I've never programmed in python before (and prior programming experience is poor) and I've been asked to fix a python program running on web2py
2018-03-14T08:19:00.000444
Jennell
pythondev_help_Jennell_2018-03-14T08:19:00.000444
1,521,015,540.000444
38,777
pythondev
help
I'd ask for help but I don't really know where to start other than sharing the error ticket
2018-03-14T08:20:09.000040
Jennell
pythondev_help_Jennell_2018-03-14T08:20:09.000040
1,521,015,609.00004
38,778
pythondev
help
<@Jennell> start from reading python books and tutorials
2018-03-14T08:21:22.000036
Aleida
pythondev_help_Aleida_2018-03-14T08:21:22.000036
1,521,015,682.000036
38,779
pythondev
help
yeah
2018-03-14T08:21:55.000355
Jennell
pythondev_help_Jennell_2018-03-14T08:21:55.000355
1,521,015,715.000355
38,780
pythondev
help
Or pay someone to do your job for you ¯\_(ツ)_/¯
2018-03-14T08:23:45.000448
Aleida
pythondev_help_Aleida_2018-03-14T08:23:45.000448
1,521,015,825.000448
38,781
pythondev
help
automate the boring stuff is a book that is often recommended
2018-03-14T08:25:49.000149
Micki
pythondev_help_Micki_2018-03-14T08:25:49.000149
1,521,015,949.000149
38,782
pythondev
help
"I've never repaired a car before (and prior repairing experience is poor) and I've been asked to fix a transmission. I'd ask for help but I don't really know where to start other than showing you a picture of the transmission"
2018-03-14T08:27:10.000133
Aleida
pythondev_help_Aleida_2018-03-14T08:27:10.000133
1,521,016,030.000133
38,783
pythondev
help
Hi, I'm looking to join the #djangolearning channel to get some feedback on Django related questions
2018-03-14T08:46:11.000318
Buddy
pythondev_help_Buddy_2018-03-14T08:46:11.000318
1,521,017,171.000318
38,784
pythondev
help
I saw on the subreddit that there was one
2018-03-14T08:46:20.000111
Buddy
pythondev_help_Buddy_2018-03-14T08:46:20.000111
1,521,017,180.000111
38,785
pythondev
help
I don't think it exist anymore. You can post django related question in <#C0LMFRMB5|django> and there is also <#C07EW4DNE|learning_python> &amp; <#C07EFMZ1N|help> for more general questions
2018-03-14T08:47:19.000098
Micki
pythondev_help_Micki_2018-03-14T08:47:19.000098
1,521,017,239.000098
38,786
pythondev
help
Alright, thanks <@Micki>
2018-03-14T08:47:44.000177
Buddy
pythondev_help_Buddy_2018-03-14T08:47:44.000177
1,521,017,264.000177
38,787
pythondev
help
<@Aleida> rofl :wink:
2018-03-14T08:49:49.000263
Terica
pythondev_help_Terica_2018-03-14T08:49:49.000263
1,521,017,389.000263
38,788
pythondev
help
Nothing wrong with learning in the wild :slightly_smiling_face:
2018-03-14T08:52:58.000208
Jeana
pythondev_help_Jeana_2018-03-14T08:52:58.000208
1,521,017,578.000208
38,789
pythondev
help
<@Jennell> check out Google's dev course on python: <https://developers.google.com/edu/python/>
2018-03-14T08:53:26.000131
Jeana
pythondev_help_Jeana_2018-03-14T08:53:26.000131
1,521,017,606.000131
38,790
pythondev
help
I find it's a nice balance between intro/textbook and real examples
2018-03-14T08:54:01.000130
Jeana
pythondev_help_Jeana_2018-03-14T08:54:01.000130
1,521,017,641.00013
38,791
pythondev
help
<@Aleida> well to be fair, fixing a transmission isn't really comparable to fixing a broken program. It's much easier to look at something mechanical and understand how it works
2018-03-14T09:38:51.000118
Jennell
pythondev_help_Jennell_2018-03-14T09:38:51.000118
1,521,020,331.000118
38,792
pythondev
help
but I do understand why you said what you said
2018-03-14T09:39:16.000238
Jennell
pythondev_help_Jennell_2018-03-14T09:39:16.000238
1,521,020,356.000238
38,793
pythondev
help
well, even if you dev skill are not high, if you have an understanding of the dev grammar and most of the common concepts to any languages, you would be able to go through the code
2018-03-14T09:59:25.000570
Terica
pythondev_help_Terica_2018-03-14T09:59:25.000570
1,521,021,565.00057
38,794
pythondev
help
now fixing any issue, that's a different thing, very depending on the complexity and the scale of the code
2018-03-14T09:59:54.000260
Terica
pythondev_help_Terica_2018-03-14T09:59:54.000260
1,521,021,594.00026
38,795
pythondev
help
halp!
2018-03-14T10:16:49.000048
Tobias
pythondev_help_Tobias_2018-03-14T10:16:49.000048
1,521,022,609.000048
38,796
pythondev
help
``` print(base64.b64encode(input.encode('utf-8')).decode())```
2018-03-14T10:16:55.000542
Tobias
pythondev_help_Tobias_2018-03-14T10:16:55.000542
1,521,022,615.000542
38,797
pythondev
help
seems _super_ silly
2018-03-14T10:17:02.000425
Tobias
pythondev_help_Tobias_2018-03-14T10:17:02.000425
1,521,022,622.000425
38,798
pythondev
help
tell me there’s a better way…
2018-03-14T10:17:09.000369
Tobias
pythondev_help_Tobias_2018-03-14T10:17:09.000369
1,521,022,629.000369
38,799
pythondev
help
the decode is superfluous
2018-03-14T10:18:19.000409
Zack
pythondev_help_Zack_2018-03-14T10:18:19.000409
1,521,022,699.000409
38,800
pythondev
help
without it i get a b’fdjafsdaf’ string and the downstream thing is vomiting on itself
2018-03-14T10:20:15.000662
Tobias
pythondev_help_Tobias_2018-03-14T10:20:15.000662
1,521,022,815.000662
38,801
pythondev
help
what is the downstream thing?
2018-03-14T10:22:59.000422
Zack
pythondev_help_Zack_2018-03-14T10:22:59.000422
1,521,022,979.000422
38,802
pythondev
help
i’m returning that to a function that is passing the output to subprocess
2018-03-14T10:23:36.000467
Tobias
pythondev_help_Tobias_2018-03-14T10:23:36.000467
1,521,023,016.000467
38,803
pythondev
help
ah, okay, sorry - thought it was for the print
2018-03-14T10:23:57.000041
Zack
pythondev_help_Zack_2018-03-14T10:23:57.000041
1,521,023,037.000041
38,804
pythondev
help
kind of surprised to hear something downstream is having a problem with it though, I think that’d just be ascii characters
2018-03-14T10:24:52.000413
Zack
pythondev_help_Zack_2018-03-14T10:24:52.000413
1,521,023,092.000413
38,805
pythondev
help
but yeah, then you’ll need to decode it back to a string object
2018-03-14T10:26:01.000601
Zack
pythondev_help_Zack_2018-03-14T10:26:01.000601
1,521,023,161.000601
38,806
pythondev
help
although that is suspicious - if you are just passing it out to the subprocess I wouldn’t expect it to be a problem. what’s the code where it bombs, and what’st he error?
2018-03-14T10:26:54.000058
Zack
pythondev_help_Zack_2018-03-14T10:26:54.000058
1,521,023,214.000058
38,807
pythondev
help
i’ve got to step out for a moment, but i think i maybe foudn it
2018-03-14T10:27:50.000352
Tobias
pythondev_help_Tobias_2018-03-14T10:27:50.000352
1,521,023,270.000352
38,808
pythondev
help
``` proc = Popen(["kubectl", kube_method, "-f", "-"], stdin=PIPE, stderr=PIPE, stdout=PIPE) proc.stdin.write(stdin.encode('utf-8')) stdout, stderr = proc.communicate()```
2018-03-14T10:28:01.000184
Tobias
pythondev_help_Tobias_2018-03-14T10:28:01.000184
1,521,023,281.000184
38,809
pythondev
help
`stdin` is the output from that command above
2018-03-14T10:28:21.000615
Tobias
pythondev_help_Tobias_2018-03-14T10:28:21.000615
1,521,023,301.000615
38,810
pythondev
help
hmm yeah I guess just come back later, that’s confusing. :stuck_out_tongue:
2018-03-14T10:29:37.000836
Zack
pythondev_help_Zack_2018-03-14T10:29:37.000836
1,521,023,377.000836
38,811
pythondev
help
haha
2018-03-14T11:00:47.000092
Tobias
pythondev_help_Tobias_2018-03-14T11:00:47.000092
1,521,025,247.000092
38,812
pythondev
help
sorry!
2018-03-14T11:00:48.000789
Tobias
pythondev_help_Tobias_2018-03-14T11:00:48.000789
1,521,025,248.000789
38,813
pythondev
help
i think i’m just sprinkling decode.() encode()s everywhere as problems crop up
2018-03-14T11:01:48.000254
Tobias
pythondev_help_Tobias_2018-03-14T11:01:48.000254
1,521,025,308.000254
38,814
pythondev
help
because yolo
2018-03-14T11:01:54.000028
Tobias
pythondev_help_Tobias_2018-03-14T11:01:54.000028
1,521,025,314.000028
38,815
pythondev
help
could create a decorator to do it for you
2018-03-14T11:02:31.000943
Terrence
pythondev_help_Terrence_2018-03-14T11:02:31.000943
1,521,025,351.000943
38,816
pythondev
help
the problem i think is py2 and py3 handle the input data differently
2018-03-14T11:02:59.000520
Tobias
pythondev_help_Tobias_2018-03-14T11:02:59.000520
1,521,025,379.00052
38,817
pythondev
help
does it do harm to encode a bytestring already? probs not?
2018-03-14T11:03:11.001061
Tobias
pythondev_help_Tobias_2018-03-14T11:03:11.001061
1,521,025,391.001061
38,818
pythondev
help
i guess it would be akin to doing `In [4]: foo.encode('utf-8').encode('utf-8')`
2018-03-14T11:03:26.000461
Tobias
pythondev_help_Tobias_2018-03-14T11:03:26.000461
1,521,025,406.000461
38,819
pythondev
help
might be affected if the bytestring was encoded in something else
2018-03-14T11:08:25.000685
Terrence
pythondev_help_Terrence_2018-03-14T11:08:25.000685
1,521,025,705.000685
38,820
pythondev
help
Thanks for this. :taco:
2018-03-14T12:15:52.000227
Josephine
pythondev_help_Josephine_2018-03-14T12:15:52.000227
1,521,029,752.000227
38,821
pythondev
help
Does anyone know how you can execute commands through python on Windows
2018-03-14T13:41:30.000438
Sharon
pythondev_help_Sharon_2018-03-14T13:41:30.000438
1,521,034,890.000438
38,822
pythondev
help
`os.system`?
2018-03-14T13:43:15.000186
Garrett
pythondev_help_Garrett_2018-03-14T13:43:15.000186
1,521,034,995.000186
38,823