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
ok im coming across some real bs here and im sure there is a reason why, but its excruciatingly frustrating. First code is copied from stackoverflow link. The second line is mine. The first line works; testeddate is a string, however on my line (2nd), data['LOGDATE'] is a string, but i get an error saying datetime object received a string. wth?
2019-03-25T12:52:29.654900
Nenita
pythondev_help_Nenita_2019-03-25T12:52:29.654900
1,553,518,349.6549
14,921
pythondev
help
Oh, absolutely, just an interesting tidbit to bring out in a code review to annoy people
2019-03-25T12:52:55.655700
Clemmie
pythondev_help_Clemmie_2019-03-25T12:52:55.655700
1,553,518,375.6557
14,922
pythondev
help
<@Nenita> it is the difference between `strptime` and `strftime`. The first takes a string and format and makes a date, the other takes a date and spits out the string in the format you asked. If you try your line with `strptime` it should work
2019-03-25T12:54:52.656900
Clemmie
pythondev_help_Clemmie_2019-03-25T12:54:52.656900
1,553,518,492.6569
14,923
pythondev
help
f :magic: -&gt; p and it works, but im having to cut the time out of the date and i thought strftime would do that.
2019-03-25T12:56:12.657700
Nenita
pythondev_help_Nenita_2019-03-25T12:56:12.657700
1,553,518,572.6577
14,924
pythondev
help
`strftime` is "format this date/time instance into a string", but `strptime` is "parse this date-like string". Very un-pythonic naming IMO
2019-03-25T12:57:19.659300
Melynda
pythondev_help_Melynda_2019-03-25T12:57:19.659300
1,553,518,639.6593
14,925
pythondev
help
i guess i could be lazy and use left(n)
2019-03-25T12:57:57.660400
Nenita
pythondev_help_Nenita_2019-03-25T12:57:57.660400
1,553,518,677.6604
14,926
pythondev
help
Right, so you need a `strptime` to make it a date object of the format wanted, and then wrap that in a `strftime` to get out the string format you want
2019-03-25T12:58:12.660700
Clemmie
pythondev_help_Clemmie_2019-03-25T12:58:12.660700
1,553,518,692.6607
14,927
pythondev
help
or, regex capture groups and reorder
2019-03-25T12:58:36.661100
Clemmie
pythondev_help_Clemmie_2019-03-25T12:58:36.661100
1,553,518,716.6611
14,928
pythondev
help
time data '02.02.2019' does not match format '%d/%m/%y' :thinking_face:
2019-03-25T12:59:26.661400
Nenita
pythondev_help_Nenita_2019-03-25T12:59:26.661400
1,553,518,766.6614
14,929
pythondev
help
Indeed, `.` is not `/`
2019-03-25T12:59:40.661600
Melynda
pythondev_help_Melynda_2019-03-25T12:59:40.661600
1,553,518,780.6616
14,930
pythondev
help
oo man i hate dates so much right now lol
2019-03-25T12:59:55.661900
Nenita
pythondev_help_Nenita_2019-03-25T12:59:55.661900
1,553,518,795.6619
14,931
pythondev
help
Will you have to work with timezones? That's where the real headaches are…
2019-03-25T13:00:28.662200
Melynda
pythondev_help_Melynda_2019-03-25T13:00:28.662200
1,553,518,828.6622
14,932
pythondev
help
no - thank God
2019-03-25T13:00:43.662600
Nenita
pythondev_help_Nenita_2019-03-25T13:00:43.662600
1,553,518,843.6626
14,933
pythondev
help
Timezones are hell on earth
2019-03-25T13:00:43.662700
My
pythondev_help_My_2019-03-25T13:00:43.662700
1,553,518,843.6627
14,934
pythondev
help
If you have some time :rolling_on_the_floor_laughing: check out this talk Russel Keith-Magee gave at Djangocon <https://www.youtube.com/watch?v=y13thlpbri8>
2019-03-25T13:03:10.663500
Clemmie
pythondev_help_Clemmie_2019-03-25T13:03:10.663500
1,553,518,990.6635
14,935
pythondev
help
so is daylights saving time &gt;.&gt;
2019-03-25T13:03:12.663700
Nenita
pythondev_help_Nenita_2019-03-25T13:03:12.663700
1,553,518,992.6637
14,936
pythondev
help
That's a subset of the general timezones problem!
2019-03-25T13:05:36.664200
Melynda
pythondev_help_Melynda_2019-03-25T13:05:36.664200
1,553,519,136.6642
14,937
pythondev
help
is there an easy way to shoot back to the start of a loop whilst in the middle of the loop?
2019-03-25T14:18:51.664800
Nenita
pythondev_help_Nenita_2019-03-25T14:18:51.664800
1,553,523,531.6648
14,938
pythondev
help
`continue`
2019-03-25T14:20:38.665400
Sasha
pythondev_help_Sasha_2019-03-25T14:20:38.665400
1,553,523,638.6654
14,939
pythondev
help
you could use `continue` inside of an `if` `else` clause
2019-03-25T14:20:42.665600
Marla
pythondev_help_Marla_2019-03-25T14:20:42.665600
1,553,523,642.6656
14,940
pythondev
help
you might be able to do this with recursion
2019-03-25T14:21:14.666100
Jorge
pythondev_help_Jorge_2019-03-25T14:21:14.666100
1,553,523,674.6661
14,941
pythondev
help
Here’s the difference between `break`, `continue`, and `pass`. <https://www.digitalocean.com/community/tutorials/how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3>
2019-03-25T14:22:21.666900
Marla
pythondev_help_Marla_2019-03-25T14:22:21.666900
1,553,523,741.6669
14,942
pythondev
help
how is continue different than pass?
2019-03-25T14:26:45.667600
Nenita
pythondev_help_Nenita_2019-03-25T14:26:45.667600
1,553,524,005.6676
14,943
pythondev
help
lol sorry didnt read the other comments
2019-03-25T14:26:59.667900
Nenita
pythondev_help_Nenita_2019-03-25T14:26:59.667900
1,553,524,019.6679
14,944
pythondev
help
thanks <@Marla>
2019-03-25T14:27:10.668100
Nenita
pythondev_help_Nenita_2019-03-25T14:27:10.668100
1,553,524,030.6681
14,945
pythondev
help
`continue` immediately jumps to the next loop iteration. `pass` does nothing. It's essentially a blank line for situations where a blank line isn't allowed.
2019-03-25T14:28:04.669000
Sasha
pythondev_help_Sasha_2019-03-25T14:28:04.669000
1,553,524,084.669
14,946
pythondev
help
there's them laymans-terms haha
2019-03-25T14:29:35.669600
Nenita
pythondev_help_Nenita_2019-03-25T14:29:35.669600
1,553,524,175.6696
14,947
pythondev
help
do u mean pandas?
2019-03-25T15:22:55.672500
Deon
pythondev_help_Deon_2019-03-25T15:22:55.672500
1,553,527,375.6725
14,948
pythondev
help
can anyone help with a json parse?
2019-03-25T16:53:55.674400
Freeda
pythondev_help_Freeda_2019-03-25T16:53:55.674400
1,553,532,835.6744
14,949
pythondev
help
looking to return all the stats under splits for each team by id <https://statsapi.web.nhl.com/api/v1/teams/?expand=team.stats>
2019-03-25T16:54:17.675000
Freeda
pythondev_help_Freeda_2019-03-25T16:54:17.675000
1,553,532,857.675
14,950
pythondev
help
but I think I'm parsing it as a dict but trying to access it as if it were a list, is that right?
2019-03-25T16:55:03.675700
Freeda
pythondev_help_Freeda_2019-03-25T16:55:03.675700
1,553,532,903.6757
14,951
pythondev
help
Please use the snippet feature, or backticks, when sharing code. You can do so by clicking on the :heavy_plus_sign: on the left of the input box for a snippet. For more information on snippets click <https://get.slack.help/hc/en-us/articles/204145658-Create-a-snippet|here>. For more information on inline code formatting with backticks click <https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages#inline-code|here>.
2019-03-25T16:55:14.675800
Leana
pythondev_help_Leana_2019-03-25T16:55:14.675800
1,553,532,914.6758
14,952
pythondev
help
None
2019-03-25T16:55:43.675900
Freeda
pythondev_help_Freeda_2019-03-25T16:55:43.675900
1,553,532,943.6759
14,953
pythondev
help
i dont see `teamStats` in the root of your data
2019-03-25T17:05:18.677000
Jorge
pythondev_help_Jorge_2019-03-25T17:05:18.677000
1,553,533,518.677
14,954
pythondev
help
in *NHLTeamsData*, your keys are `copyright` and `teams`
2019-03-25T17:05:48.677600
Jorge
pythondev_help_Jorge_2019-03-25T17:05:48.677600
1,553,533,548.6776
14,955
pythondev
help
you could do something like ``` for team in NHLTeamsData['teams']: #traverse the team data here ```
2019-03-25T17:08:01.679800
Jorge
pythondev_help_Jorge_2019-03-25T17:08:01.679800
1,553,533,681.6798
14,956
pythondev
help
Ah I see... so I missed a layer
2019-03-25T17:08:08.680100
Freeda
pythondev_help_Freeda_2019-03-25T17:08:08.680100
1,553,533,688.6801
14,957
pythondev
help
changing it to NHLTeamsData = req.json()['teams'][0] would prob be a start
2019-03-25T17:08:24.680400
Deon
pythondev_help_Deon_2019-03-25T17:08:24.680400
1,553,533,704.6804
14,958
pythondev
help
don't add that [0]
2019-03-25T17:08:35.680600
Jorge
pythondev_help_Jorge_2019-03-25T17:08:35.680600
1,553,533,715.6806
14,959
pythondev
help
it'll just give you one team
2019-03-25T17:08:39.680800
Jorge
pythondev_help_Jorge_2019-03-25T17:08:39.680800
1,553,533,719.6808
14,960
pythondev
help
yep true ^
2019-03-25T17:08:48.681100
Deon
pythondev_help_Deon_2019-03-25T17:08:48.681100
1,553,533,728.6811
14,961
pythondev
help
if you check out the api call in firefox, you can see the structure pretty nicely
2019-03-25T17:09:00.681400
Jorge
pythondev_help_Jorge_2019-03-25T17:09:00.681400
1,553,533,740.6814
14,962
pythondev
help
None
2019-03-25T17:09:05.681700
Jorge
pythondev_help_Jorge_2019-03-25T17:09:05.681700
1,553,533,745.6817
14,963
pythondev
help
id prob do range(len(nhlteamsdata)) &amp; iter through
2019-03-25T17:09:16.682100
Deon
pythondev_help_Deon_2019-03-25T17:09:16.682100
1,553,533,756.6821
14,964
pythondev
help
oh that's so much easier to view than just looking at the browser. I'm new to python, as I'm sure you can tell :slightly_smiling_face:
2019-03-25T17:10:36.682700
Freeda
pythondev_help_Freeda_2019-03-25T17:10:36.682700
1,553,533,836.6827
14,965
pythondev
help
wow Firefox... lets goo
2019-03-25T17:11:53.684100
Freeda
pythondev_help_Freeda_2019-03-25T17:11:53.684100
1,553,533,913.6841
14,966
pythondev
help
you've got the right idea with your code. you just have to check and make sure how you traverse it. some of this data is in a list, some of it is python dicts/json objects
2019-03-25T17:11:55.684200
Jorge
pythondev_help_Jorge_2019-03-25T17:11:55.684200
1,553,533,915.6842
14,967
pythondev
help
That's annoying
2019-03-25T17:12:17.684700
Freeda
pythondev_help_Freeda_2019-03-25T17:12:17.684700
1,553,533,937.6847
14,968
pythondev
help
so should I be converting it all to lists as I go?
2019-03-25T17:12:26.685100
Freeda
pythondev_help_Freeda_2019-03-25T17:12:26.685100
1,553,533,946.6851
14,969
pythondev
help
you'll probably run into some KeyErrors/TypErrors
2019-03-25T17:12:29.685300
Jorge
pythondev_help_Jorge_2019-03-25T17:12:29.685300
1,553,533,949.6853
14,970
pythondev
help
Yeah I was hitting those before I started over again haha
2019-03-25T17:12:46.686000
Freeda
pythondev_help_Freeda_2019-03-25T17:12:46.686000
1,553,533,966.686
14,971
pythondev
help
if this is annoying, wait til you see some of the other apis out there
2019-03-25T17:12:48.686100
Deon
pythondev_help_Deon_2019-03-25T17:12:48.686100
1,553,533,968.6861
14,972
pythondev
help
I believe it... this one seems pretty solid, I'm just an idiot
2019-03-25T17:13:11.686600
Freeda
pythondev_help_Freeda_2019-03-25T17:13:11.686600
1,553,533,991.6866
14,973
pythondev
help
interesting...*splits* for each team is a list
2019-03-25T17:13:55.687100
Jorge
pythondev_help_Jorge_2019-03-25T17:13:55.687100
1,553,534,035.6871
14,974
pythondev
help
yeah I really dont like that part
2019-03-25T17:14:29.687500
Freeda
pythondev_help_Freeda_2019-03-25T17:14:29.687500
1,553,534,069.6875
14,975
pythondev
help
idk how ill tackle that
2019-03-25T17:14:35.687800
Freeda
pythondev_help_Freeda_2019-03-25T17:14:35.687800
1,553,534,075.6878
14,976
pythondev
help
Ok, so this seems like a better start, right?
2019-03-25T17:15:49.688500
Freeda
pythondev_help_Freeda_2019-03-25T17:15:49.688500
1,553,534,149.6885
14,977
pythondev
help
<https://github.com/dword4/nhlapi>
2019-03-25T17:15:54.688900
Hiroko
pythondev_help_Hiroko_2019-03-25T17:15:54.688900
1,553,534,154.6889
14,978
pythondev
help
check that out
2019-03-25T17:15:58.689300
Hiroko
pythondev_help_Hiroko_2019-03-25T17:15:58.689300
1,553,534,158.6893
14,979
pythondev
help
Yeah, he's just explaining the links though
2019-03-25T17:16:36.689700
Freeda
pythondev_help_Freeda_2019-03-25T17:16:36.689700
1,553,534,196.6897
14,980
pythondev
help
right?
2019-03-25T17:16:43.690000
Freeda
pythondev_help_Freeda_2019-03-25T17:16:43.690000
1,553,534,203.69
14,981
pythondev
help
how do I get all the way down to the two splits from TeamStats? there are so many levels and it looks like splits and teamStats are lists and the rest dicts
2019-03-25T17:21:35.691600
Freeda
pythondev_help_Freeda_2019-03-25T17:21:35.691600
1,553,534,495.6916
14,982
pythondev
help
yea, this is all it says about the teams data: ``` Teams GET <https://statsapi.web.nhl.com/api/v1/teams> Returns a list of data about all teams including their id, venue details, division, conference and franchise information. ``` say if you wanted to get the best team in hockeys wins, you'd do this: ``` NHLTeamsData['teams'][18]['teamStats'][0]['splits'][0]['stat']['wins'] ```
2019-03-25T17:21:55.692000
Jorge
pythondev_help_Jorge_2019-03-25T17:21:55.692000
1,553,534,515.692
14,983
pythondev
help
if you wanted to get the best team's name, you'd do this: ``` NHLTeamsData['teams'][18]['name'] ```
2019-03-25T17:22:28.692600
Jorge
pythondev_help_Jorge_2019-03-25T17:22:28.692600
1,553,534,548.6926
14,984
pythondev
help
getting a KeyError on teamStats, must be the list vs dict thing
2019-03-25T17:25:04.692700
Freeda
pythondev_help_Freeda_2019-03-25T17:25:04.692700
1,553,534,704.6927
14,985
pythondev
help
its not
2019-03-25T17:26:45.694500
Deon
pythondev_help_Deon_2019-03-25T17:26:45.694500
1,553,534,805.6945
14,986
pythondev
help
i think its NHLTeamsData['teamStats']['splits']
2019-03-25T17:26:59.695000
Deon
pythondev_help_Deon_2019-03-25T17:26:59.695000
1,553,534,819.695
14,987
pythondev
help
Ahh I can truncate it like that??
2019-03-25T17:27:10.695500
Freeda
pythondev_help_Freeda_2019-03-25T17:27:10.695500
1,553,534,830.6955
14,988
pythondev
help
in this part: ``` for stat in NHLTeamsData['teamStats']: for split in NHLTeamsData['splits']: for stat in NHLTeamsData['stat']: gamesPlayed = stat['gamesPlayed'] ``` you're traversing that a bit wrong essentially that creates for loops over keys that dont exist on the root dict what you want is this: ``` for stat in team['teamStats']: for split in stat: for stat in split['stat']: gamesPlayed = stat['gamesPlayed'] ```
2019-03-25T17:27:11.695600
Jorge
pythondev_help_Jorge_2019-03-25T17:27:11.695600
1,553,534,831.6956
14,989
pythondev
help
and that's because the loops won't iterate in those levels?
2019-03-25T17:27:58.696500
Freeda
pythondev_help_Freeda_2019-03-25T17:27:58.696500
1,553,534,878.6965
14,990
pythondev
help
friggin VPN/DNS issues.... my browser can find `{hostname}` but not `admin.{hostname}`
2019-03-25T17:29:29.698000
Claudine
pythondev_help_Claudine_2019-03-25T17:29:29.698000
1,553,534,969.698
14,991
pythondev
help
happens like every other day and then im shot for the day until it decides to work again
2019-03-25T17:29:44.698600
Claudine
pythondev_help_Claudine_2019-03-25T17:29:44.698600
1,553,534,984.6986
14,992
pythondev
help
you might have to edit what i wrote abit, but you're trying to iterate over the root of you dict. remember NHLTeamsData only has `copyright` and `teams`
2019-03-25T17:29:46.698700
Jorge
pythondev_help_Jorge_2019-03-25T17:29:46.698700
1,553,534,986.6987
14,993
pythondev
help
if you call anything else on *NHLTeamsData* besides `copyright` and `teams`, you'll get a key error
2019-03-25T17:30:17.699600
Jorge
pythondev_help_Jorge_2019-03-25T17:30:17.699600
1,553,535,017.6996
14,994
pythondev
help
hmmm ok
2019-03-25T17:30:26.699800
Freeda
pythondev_help_Freeda_2019-03-25T17:30:26.699800
1,553,535,026.6998
14,995
pythondev
help
appreciate the help
2019-03-25T17:30:28.700000
Freeda
pythondev_help_Freeda_2019-03-25T17:30:28.700000
1,553,535,028.7
14,996
pythondev
help
np
2019-03-25T17:31:07.700400
Jorge
pythondev_help_Jorge_2019-03-25T17:31:07.700400
1,553,535,067.7004
14,997
pythondev
help
last question: what's the point of these [0]'s
2019-03-25T17:32:47.700500
Freeda
pythondev_help_Freeda_2019-03-25T17:32:47.700500
1,553,535,167.7005
14,998
pythondev
help
these are tripping me up
2019-03-25T17:32:55.700900
Freeda
pythondev_help_Freeda_2019-03-25T17:32:55.700900
1,553,535,175.7009
14,999
pythondev
help
That's how Firefox is representing a list, faking it as if it were a dict with keys of 0, 1, 2, etc.
2019-03-25T17:33:58.701600
Sasha
pythondev_help_Sasha_2019-03-25T17:33:58.701600
1,553,535,238.7016
15,000
pythondev
help
My catboost notebook <https://github.com/paulgureghian/CatBoost/blob/master/CatBoost.ipynb>
2019-03-25T21:22:18.703200
Clayton
pythondev_help_Clayton_2019-03-25T21:22:18.703200
1,553,548,938.7032
15,001
pythondev
help
Hi Guys! In django, is there a global place for handling exception (like wsgi.py). I’m trying to do somehting like this: ``` try: handle any type of request except Exception: logging.exception() -&gt; in some specific format ``` ?
2019-03-25T21:25:30.705000
Angelita
pythondev_help_Angelita_2019-03-25T21:25:30.705000
1,553,549,130.705
15,002
pythondev
help
Can I use a `pdb` in a Django management command?
2019-03-25T22:44:42.706300
Lawrence
pythondev_help_Lawrence_2019-03-25T22:44:42.706300
1,553,553,882.7063
15,003
pythondev
help
it doesn't seem to trigger when I run the command
2019-03-25T22:45:04.706600
Lawrence
pythondev_help_Lawrence_2019-03-25T22:45:04.706600
1,553,553,904.7066
15,004
pythondev
help
sure
2019-03-25T22:45:48.706800
Hiroko
pythondev_help_Hiroko_2019-03-25T22:45:48.706800
1,553,553,948.7068
15,005
pythondev
help
is this with docker?
2019-03-25T22:45:54.707100
Hiroko
pythondev_help_Hiroko_2019-03-25T22:45:54.707100
1,553,553,954.7071
15,006
pythondev
help
I recall needing to run `--service-ports` in order to get the debugger port connection
2019-03-25T22:46:13.707600
Hiroko
pythondev_help_Hiroko_2019-03-25T22:46:13.707600
1,553,553,973.7076
15,007
pythondev
help
ah - it is with Docker
2019-03-25T22:46:53.707800
Lawrence
pythondev_help_Lawrence_2019-03-25T22:46:53.707800
1,553,554,013.7078
15,008
pythondev
help
is that an argument with the management command?
2019-03-25T22:47:10.708200
Lawrence
pythondev_help_Lawrence_2019-03-25T22:47:10.708200
1,553,554,030.7082
15,009
pythondev
help
interestingly I ran `docker-compose exec django bash` to get a bash shell
2019-03-25T22:47:36.708700
Lawrence
pythondev_help_Lawrence_2019-03-25T22:47:36.708700
1,553,554,056.7087
15,010
pythondev
help
no, docker itse
2019-03-25T22:48:32.708900
Hiroko
pythondev_help_Hiroko_2019-03-25T22:48:32.708900
1,553,554,112.7089
15,011
pythondev
help
`docker-compose run --rm --service-ports &lt;container_name&gt; python manage.py &lt;management_command&gt;`
2019-03-25T22:49:04.709800
Hiroko
pythondev_help_Hiroko_2019-03-25T22:49:04.709800
1,553,554,144.7098
15,012
pythondev
help
or thereabouts
2019-03-25T22:49:13.710000
Hiroko
pythondev_help_Hiroko_2019-03-25T22:49:13.710000
1,553,554,153.71
15,013
pythondev
help
<https://gist.github.com/katylava/3559c29160573488a7bbccb474b55356>
2019-03-25T22:50:10.710200
Hiroko
pythondev_help_Hiroko_2019-03-25T22:50:10.710200
1,553,554,210.7102
15,014
pythondev
help
gist from a coworker of mine
2019-03-25T22:50:15.710400
Hiroko
pythondev_help_Hiroko_2019-03-25T22:50:15.710400
1,553,554,215.7104
15,015
pythondev
help
<@Hiroko> :taco: :taco: :taco: that works - extra tacos for responding so late at night!
2019-03-25T22:51:04.710800
Lawrence
pythondev_help_Lawrence_2019-03-25T22:51:04.710800
1,553,554,264.7108
15,016
pythondev
help
Can anyone help me with why my regex won't work with `re.compile()`, but will work pretty much anywhere else?
2019-03-26T00:04:32.711800
Candra
pythondev_help_Candra_2019-03-26T00:04:32.711800
1,553,558,672.7118
15,017
pythondev
help
``` clip_regex = re.compile(r'/(?:https://)?clips\.twitch\.tv/(\S+)/i') clip_regex.match('<https://clips.twitch.tv/IcyZealousLapwingBloodTrail> sdf') ```
2019-03-26T00:04:39.712200
Candra
pythondev_help_Candra_2019-03-26T00:04:39.712200
1,553,558,679.7122
15,018
pythondev
help
Should give a match for the link, and it does even here <http://regexr.com/4avmi|regexr.com/4avmi>
2019-03-26T00:05:17.712700
Candra
pythondev_help_Candra_2019-03-26T00:05:17.712700
1,553,558,717.7127
15,019
pythondev
help
Also with `re.compile(r'/(?:https:\/\/)?clips\.twitch\.tv\/(\S+)/i')` It doesn't work
2019-03-26T00:06:08.713600
Candra
pythondev_help_Candra_2019-03-26T00:06:08.713600
1,553,558,768.7136
15,020