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
would you have a suggestion as to how to constructively build a date with arbitrary y/m/d information using the date time method? I am not too familiar with how to use it correctly so I may have had a bad implementation
2017-10-31T10:16:11.000196
Lory
pythondev_help_Lory_2017-10-31T10:16:11.000196
1,509,444,971.000196
98,803
pythondev
help
<@Lory> sounds like a job for <http://dateutil.readthedocs.io/en/stable/parser.html>
2017-10-31T10:19:04.000490
Collette
pythondev_help_Collette_2017-10-31T10:19:04.000490
1,509,445,144.00049
98,804
pythondev
help
<https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime>
2017-10-31T10:19:05.000066
Ciera
pythondev_help_Ciera_2017-10-31T10:19:05.000066
1,509,445,145.000066
98,805
pythondev
help
`strptime` is good when you have a fixed known format, `dateutil` is good when you just need to parse damn dates :slightly_smiling_face:
2017-10-31T10:19:38.000342
Collette
pythondev_help_Collette_2017-10-31T10:19:38.000342
1,509,445,178.000342
98,806
pythondev
help
yep. with only a few different format I'm not sure which one is the best, but idk how many different format mike expect
2017-10-31T10:21:05.000369
Ciera
pythondev_help_Ciera_2017-10-31T10:21:05.000369
1,509,445,265.000369
98,807
pythondev
help
I'll look deeper into that aspect. However, ignoring the dates and looking at the if/else structure I have set up, is there any other way to construct it such that I don't need 2 areas in which I check the status of `has_day` or is that inherently impossible because I need to first check the length of the date I have?
2017-10-31T10:25:14.000221
Lory
pythondev_help_Lory_2017-10-31T10:25:14.000221
1,509,445,514.000221
98,808
pythondev
help
and all formats end up being `yymmdd` it's just a matter of what does it have currently, what is it expected to have and then any missing information is appended if needed, aka the day information which defaults to `01`
2017-10-31T10:26:16.000545
Lory
pythondev_help_Lory_2017-10-31T10:26:16.000545
1,509,445,576.000545
98,809
pythondev
help
on the top of my head I don't have any idea to check both condition
2017-10-31T10:27:07.000154
Ciera
pythondev_help_Ciera_2017-10-31T10:27:07.000154
1,509,445,627.000154
98,810
pythondev
help
Fair enough. I have a tendency to look too much into optimization lol. I'm going to dive into those date formats and see how that goes
2017-10-31T10:29:53.000362
Lory
pythondev_help_Lory_2017-10-31T10:29:53.000362
1,509,445,793.000362
98,811
pythondev
help
well you could do a function but if the check is only a line or two long it's not necessary
2017-10-31T10:30:33.000261
Ciera
pythondev_help_Ciera_2017-10-31T10:30:33.000261
1,509,445,833.000261
98,812
pythondev
help
Exactly what I was thinking, it would just take from the readability of the code
2017-10-31T10:31:06.000519
Lory
pythondev_help_Lory_2017-10-31T10:31:06.000519
1,509,445,866.000519
98,813
pythondev
help
depending on the conditions sometime having a 4 branch if/elif might be more readable but ¯\_(ツ)_/¯
2017-10-31T10:31:21.000363
Ciera
pythondev_help_Ciera_2017-10-31T10:31:21.000363
1,509,445,881.000363
98,814
pythondev
help
lol thanks. I'll just let it be for now and maybe I'll have an epiphany one day
2017-10-31T10:33:10.000773
Lory
pythondev_help_Lory_2017-10-31T10:33:10.000773
1,509,445,990.000773
98,815
pythondev
help
Quick question... What does the line "Global E" (Line 6) do in the following code snippet?
2017-10-31T11:13:22.000044
Virgen
pythondev_help_Virgen_2017-10-31T11:13:22.000044
1,509,448,402.000044
98,816
pythondev
help
as I recently found out, that allows you to create mutable global variables
2017-10-31T11:14:26.000584
Lory
pythondev_help_Lory_2017-10-31T11:14:26.000584
1,509,448,466.000584
98,817
pythondev
help
It doesn't create them, it says the global is mutable from within this function.
2017-10-31T11:15:05.000384
Meghan
pythondev_help_Meghan_2017-10-31T11:15:05.000384
1,509,448,505.000384
98,818
pythondev
help
Well in that one it is in a comment
2017-10-31T11:15:09.000384
Vada
pythondev_help_Vada_2017-10-31T11:15:09.000384
1,509,448,509.000384
98,819
pythondev
help
so it doesn't do anything
2017-10-31T11:15:17.000447
Vada
pythondev_help_Vada_2017-10-31T11:15:17.000447
1,509,448,517.000447
98,820
pythondev
help
Which is something you generally want to avoid doing in a production level piece of software. I personally cheat when writing test scripts to work out a specific function
2017-10-31T11:15:20.000882
Lory
pythondev_help_Lory_2017-10-31T11:15:20.000882
1,509,448,520.000882
98,821
pythondev
help
correct. commented or not makes no difference when I run the snippet.
2017-10-31T11:15:35.000351
Virgen
pythondev_help_Virgen_2017-10-31T11:15:35.000351
1,509,448,535.000351
98,822
pythondev
help
They are probably indicating they are using the global E.
2017-10-31T11:15:36.000357
Meghan
pythondev_help_Meghan_2017-10-31T11:15:36.000357
1,509,448,536.000357
98,823
pythondev
help
<@Meghan> E has not been created beforehand so does get created there.
2017-10-31T11:15:47.000375
Vada
pythondev_help_Vada_2017-10-31T11:15:47.000375
1,509,448,547.000375
98,824
pythondev
help
And yes, there is rarely a reason for it.
2017-10-31T11:15:54.000746
Meghan
pythondev_help_Meghan_2017-10-31T11:15:54.000746
1,509,448,554.000746
98,825
pythondev
help
actually you are right sorry
2017-10-31T11:16:02.000353
Vada
pythondev_help_Vada_2017-10-31T11:16:02.000353
1,509,448,562.000353
98,826
pythondev
help
it gets declared later - this is just the person saying it is the global E
2017-10-31T11:16:18.000171
Vada
pythondev_help_Vada_2017-10-31T11:16:18.000171
1,509,448,578.000171
98,827
pythondev
help
<@Virgen> without `global foo`, `foo = something` creates a local variable `foo` instead of modifying the global one
2017-10-31T11:16:22.000599
Collette
pythondev_help_Collette_2017-10-31T11:16:22.000599
1,509,448,582.000599
98,828
pythondev
help
That isn't really later, since the stuff outside of the function are executed before the function.
2017-10-31T11:16:44.000101
Meghan
pythondev_help_Meghan_2017-10-31T11:16:44.000101
1,509,448,604.000101
98,829
pythondev
help
<@Meghan> corrected myself after :wink:
2017-10-31T11:19:26.000399
Vada
pythondev_help_Vada_2017-10-31T11:19:26.000399
1,509,448,766.000399
98,830
pythondev
help
I think I understand. So, if I were to expand on this initial snippet and wanted to use "E" later on, outside of the function, I would need to use the "Global E" to change the Global variable.
2017-10-31T11:20:05.000618
Virgen
pythondev_help_Virgen_2017-10-31T11:20:05.000618
1,509,448,805.000618
98,831
pythondev
help
without the "Global E", the value of E would be unchanged outside of the function.
2017-10-31T11:20:27.000175
Virgen
pythondev_help_Virgen_2017-10-31T11:20:27.000175
1,509,448,827.000175
98,832
pythondev
help
correct?
2017-10-31T11:20:29.000097
Virgen
pythondev_help_Virgen_2017-10-31T11:20:29.000097
1,509,448,829.000097
98,833
pythondev
help
If you wanted to modify it in some way yes, otherwise if it is simply a reference variable like a file path or something that you do not plan on modifying, then you do not need `global`
2017-10-31T11:21:27.000498
Lory
pythondev_help_Lory_2017-10-31T11:21:27.000498
1,509,448,887.000498
98,834
pythondev
help
you only need `global VARIABLE` when you plan on modifying that data structure, which as everyone says, shouldn't really be done
2017-10-31T11:22:04.000362
Lory
pythondev_help_Lory_2017-10-31T11:22:04.000362
1,509,448,924.000362
98,835
pythondev
help
In that snippet, in that function. Is "E" getting modified? Or is it being used to assign the users input to "string"?
2017-10-31T11:23:36.000674
Virgen
pythondev_help_Virgen_2017-10-31T11:23:36.000674
1,509,449,016.000674
98,836
pythondev
help
here is a good SO post on it.
2017-10-31T11:23:47.000123
Vada
pythondev_help_Vada_2017-10-31T11:23:47.000123
1,509,449,027.000123
98,837
pythondev
help
<https://stackoverflow.com/a/4693385>
2017-10-31T11:23:47.000465
Vada
pythondev_help_Vada_2017-10-31T11:23:47.000465
1,509,449,027.000465
98,838
pythondev
help
in which case, "string" is what would hold that data that would get used later.
2017-10-31T11:23:52.000972
Virgen
pythondev_help_Virgen_2017-10-31T11:23:52.000972
1,509,449,032.000972
98,839
pythondev
help
And in the code given, E is not modified
2017-10-31T11:23:59.000379
Vada
pythondev_help_Vada_2017-10-31T11:23:59.000379
1,509,449,039.000379
98,840
pythondev
help
it is assigning the users input to `string`
2017-10-31T11:24:16.000043
Vada
pythondev_help_Vada_2017-10-31T11:24:16.000043
1,509,449,056.000043
98,841
pythondev
help
it isn't it is simply being referenced and saved in the variable `string` which is local to that function and therefore mutable
2017-10-31T11:24:24.000004
Lory
pythondev_help_Lory_2017-10-31T11:24:24.000004
1,509,449,064.000004
98,842
pythondev
help
so even more of a reason that "Global E" is unnecessary.
2017-10-31T11:24:41.000315
Virgen
pythondev_help_Virgen_2017-10-31T11:24:41.000315
1,509,449,081.000315
98,843
pythondev
help
mutability is a different thing....
2017-10-31T11:24:42.000549
Vada
pythondev_help_Vada_2017-10-31T11:24:42.000549
1,509,449,082.000549
98,844
pythondev
help
?
2017-10-31T11:24:43.000322
Virgen
pythondev_help_Virgen_2017-10-31T11:24:43.000322
1,509,449,083.000322
98,845
pythondev
help
yep
2017-10-31T11:24:50.000732
Vada
pythondev_help_Vada_2017-10-31T11:24:50.000732
1,509,449,090.000732
98,846
pythondev
help
got it. Thank you all!
2017-10-31T11:25:28.000921
Virgen
pythondev_help_Virgen_2017-10-31T11:25:28.000921
1,509,449,128.000921
98,847
pythondev
help
and, <@Vada> I'll check out that SO post. thank you!
2017-10-31T11:26:30.000768
Virgen
pythondev_help_Virgen_2017-10-31T11:26:30.000768
1,509,449,190.000768
98,848
pythondev
help
<@Lory> how did you format the snippets in your posts?
2017-10-31T11:28:15.000396
Virgen
pythondev_help_Virgen_2017-10-31T11:28:15.000396
1,509,449,295.000396
98,849
pythondev
help
and <@Vada> is correct I didn't mean mutable, just that it is local and you can assign new data to that variable. mutability has to do with 'identity' <https://stackoverflow.com/questions/8056130/immutable-vs-mutable-types> and how do you mean <@Virgen>, your formatted code looks the same as mine as far as I can tell
2017-10-31T11:29:27.000571
Lory
pythondev_help_Lory_2017-10-31T11:29:27.000571
1,509,449,367.000571
98,850
pythondev
help
<@Virgen> <https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages#code-blocks>
2017-10-31T11:29:54.000375
Meg
pythondev_help_Meg_2017-10-31T11:29:54.000375
1,509,449,394.000375
98,851
pythondev
help
The problem I am finding with this is I don't know how to then modify the `day` if I need to later on in my code depending the `has_day` flag I was showing off earlier. Would I have to convert it back to a string, modify it and then reconvert back to date time?
2017-10-31T11:42:44.000214
Lory
pythondev_help_Lory_2017-10-31T11:42:44.000214
1,509,450,164.000214
98,852
pythondev
help
I believe you can do `date.day = 1`
2017-10-31T11:46:05.000382
Ciera
pythondev_help_Ciera_2017-10-31T11:46:05.000382
1,509,450,365.000382
98,853
pythondev
help
but you'll need to test
2017-10-31T11:46:09.000235
Ciera
pythondev_help_Ciera_2017-10-31T11:46:09.000235
1,509,450,369.000235
98,854
pythondev
help
<@Lory> I meant the small bits within your replies. `like this`. which I have now figured out is back ticks. thanks <@Meg>
2017-10-31T11:53:38.000931
Virgen
pythondev_help_Virgen_2017-10-31T11:53:38.000931
1,509,450,818.000931
98,855
pythondev
help
<@Virgen> ah, sorry didn't realize you meant those. Glad you figured it out though!
2017-10-31T11:54:02.000066
Lory
pythondev_help_Lory_2017-10-31T11:54:02.000066
1,509,450,842.000066
98,856
pythondev
help
:thumbsup: it helps alot
2017-10-31T11:54:04.000928
Meg
pythondev_help_Meg_2017-10-31T11:54:04.000928
1,509,450,844.000928
98,857
pythondev
help
and also, it carries over from github issues too
2017-10-31T11:54:12.000818
Meg
pythondev_help_Meg_2017-10-31T11:54:12.000818
1,509,450,852.000818
98,858
pythondev
help
and StackOverflow
2017-10-31T11:54:20.000596
Meg
pythondev_help_Meg_2017-10-31T11:54:20.000596
1,509,450,860.000596
98,859
pythondev
help
<@Lory> anytime date/time/day anything like that shows up, I immediate ask if they've check out the arrow package, if either for implementation or for source code analysis <http://arrow.readthedocs.io/en/latest/>
2017-10-31T13:33:22.000271
Seema
pythondev_help_Seema_2017-10-31T13:33:22.000271
1,509,456,802.000271
98,860
pythondev
help
Thanks <@Seema>! I'll look into that as soon as I can
2017-10-31T13:46:10.000255
Lory
pythondev_help_Lory_2017-10-31T13:46:10.000255
1,509,457,570.000255
98,861
pythondev
help
i get this output
2017-10-31T14:30:45.000537
Kandis
pythondev_help_Kandis_2017-10-31T14:30:45.000537
1,509,460,245.000537
98,862
pythondev
help
:
2017-10-31T14:30:47.000107
Kandis
pythondev_help_Kandis_2017-10-31T14:30:47.000107
1,509,460,247.000107
98,863
pythondev
help
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) &lt;ipython-input-165-ac8e0e59e314&gt; in &lt;module&gt;() 6 return non_udacity_data 7 ----&gt; 8 non_udacity_enrollments=udacity_removed(enrollments) ...
2017-10-31T14:30:48.000687
Kandis
pythondev_help_Kandis_2017-10-31T14:30:48.000687
1,509,460,248.000687
98,864
pythondev
help
why??
2017-10-31T14:30:58.000071
Kandis
pythondev_help_Kandis_2017-10-31T14:30:58.000071
1,509,460,258.000071
98,865
pythondev
help
:thinking_face:
2017-10-31T14:31:19.000263
Kandis
pythondev_help_Kandis_2017-10-31T14:31:19.000263
1,509,460,279.000263
98,866
pythondev
help
`data_point` must be a list
2017-10-31T14:31:45.000086
Frieda
pythondev_help_Frieda_2017-10-31T14:31:45.000086
1,509,460,305.000086
98,867
pythondev
help
why can I use :”
2017-10-31T14:33:18.000379
Kandis
pythondev_help_Kandis_2017-10-31T14:33:18.000379
1,509,460,398.000379
98,868
pythondev
help
for enrollment in enrollments
2017-10-31T14:33:21.000035
Kandis
pythondev_help_Kandis_2017-10-31T14:33:21.000035
1,509,460,401.000035
98,869
pythondev
help
if enrollment[‘is_udacity’]:
2017-10-31T14:33:31.000341
Kandis
pythondev_help_Kandis_2017-10-31T14:33:31.000341
1,509,460,411.000341
98,870
pythondev
help
"
2017-10-31T14:33:37.000062
Kandis
pythondev_help_Kandis_2017-10-31T14:33:37.000062
1,509,460,417.000062
98,871
pythondev
help
enrollment here should be a list too?
2017-10-31T14:33:46.000115
Kandis
pythondev_help_Kandis_2017-10-31T14:33:46.000115
1,509,460,426.000115
98,872
pythondev
help
uhm, enrollement is a dict, apparently
2017-10-31T14:34:01.000656
Meg
pythondev_help_Meg_2017-10-31T14:34:01.000656
1,509,460,441.000656
98,873
pythondev
help
oh! so unless i define the “data” as a dictionary, i can only use data_point as a string?
2017-10-31T14:35:02.000556
Kandis
pythondev_help_Kandis_2017-10-31T14:35:02.000556
1,509,460,502.000556
98,874
pythondev
help
and based on my code now, what do you think i should modify it
2017-10-31T14:35:20.000151
Kandis
pythondev_help_Kandis_2017-10-31T14:35:20.000151
1,509,460,520.000151
98,875
pythondev
help
remember, you can access a list by index. eg `some_list[3]`, but a dict has to be accessted by a key. eg `some_dict['some_key']`
2017-10-31T14:35:20.000434
Meg
pythondev_help_Meg_2017-10-31T14:35:20.000434
1,509,460,520.000434
98,876
pythondev
help
yup yup
2017-10-31T14:35:33.000432
Kandis
pythondev_help_Kandis_2017-10-31T14:35:33.000432
1,509,460,533.000432
98,877
pythondev
help
so, you need to iterate over a dict
2017-10-31T14:35:51.000195
Meg
pythondev_help_Meg_2017-10-31T14:35:51.000195
1,509,460,551.000195
98,878
pythondev
help
are you using python 2 or 3?
2017-10-31T14:35:55.000804
Meg
pythondev_help_Meg_2017-10-31T14:35:55.000804
1,509,460,555.000804
98,879
pythondev
help
3
2017-10-31T14:36:01.000457
Kandis
pythondev_help_Kandis_2017-10-31T14:36:01.000457
1,509,460,561.000457
98,880
pythondev
help
do i add: data={}
2017-10-31T14:36:20.000262
Kandis
pythondev_help_Kandis_2017-10-31T14:36:20.000262
1,509,460,580.000262
98,881
pythondev
help
what you want is `for key, value in enrollments.items():`
2017-10-31T14:36:34.000485
Meg
pythondev_help_Meg_2017-10-31T14:36:34.000485
1,509,460,594.000485
98,882
pythondev
help
i dont understand
2017-10-31T14:38:02.000369
Kandis
pythondev_help_Kandis_2017-10-31T14:38:02.000369
1,509,460,682.000369
98,883
pythondev
help
and also i want it to be a function
2017-10-31T14:38:27.000554
Kandis
pythondev_help_Kandis_2017-10-31T14:38:27.000554
1,509,460,707.000554
98,884
pythondev
help
:thinking_face:
2017-10-31T14:38:33.000391
Kandis
pythondev_help_Kandis_2017-10-31T14:38:33.000391
1,509,460,713.000391
98,885
pythondev
help
how about you step back a bit, and tell us what you’re trying to accomplish
2017-10-31T14:39:38.000716
Meg
pythondev_help_Meg_2017-10-31T14:39:38.000716
1,509,460,778.000716
98,886
pythondev
help
its obvious you’re trying to add and remove some enrollments, but any more than that is unknown
2017-10-31T14:40:21.000514
Meg
pythondev_help_Meg_2017-10-31T14:40:21.000514
1,509,460,821.000514
98,887
pythondev
help
for example, what is `enrollements`?
2017-10-31T14:40:34.000351
Meg
pythondev_help_Meg_2017-10-31T14:40:34.000351
1,509,460,834.000351
98,888
pythondev
help
here it is <@Meg>
2017-10-31T14:46:12.000153
Kandis
pythondev_help_Kandis_2017-10-31T14:46:12.000153
1,509,461,172.000153
98,889
pythondev
help
:laughing:
2017-10-31T14:46:19.000401
Kandis
pythondev_help_Kandis_2017-10-31T14:46:19.000401
1,509,461,179.000401
98,890
pythondev
help
sorry for the typos in my description hehe
2017-10-31T14:46:46.000748
Kandis
pythondev_help_Kandis_2017-10-31T14:46:46.000748
1,509,461,206.000748
98,891
pythondev
help
so, enrollments is a list of dicts?
2017-10-31T14:48:55.000395
Meg
pythondev_help_Meg_2017-10-31T14:48:55.000395
1,509,461,335.000395
98,892
pythondev
help
and for some reason, in `udacity_removed`, it gets moved to a regular list
2017-10-31T14:49:17.000566
Meg
pythondev_help_Meg_2017-10-31T14:49:17.000566
1,509,461,357.000566
98,893
pythondev
help
yes enrollments is a csv file
2017-10-31T14:51:23.000286
Kandis
pythondev_help_Kandis_2017-10-31T14:51:23.000286
1,509,461,483.000286
98,894
pythondev
help
uhm
2017-10-31T14:51:40.000613
Meg
pythondev_help_Meg_2017-10-31T14:51:40.000613
1,509,461,500.000613
98,895
pythondev
help
Couldn't it also be coming from daily_engagement since the function is also being called with that?
2017-10-31T14:51:49.000409
Antionette
pythondev_help_Antionette_2017-10-31T14:51:49.000409
1,509,461,509.000409
98,896
pythondev
help
OrderedDict([('account_key', '1304'), ('status', 'canceled'), ('join_date', datetime.datetime(2015, 1, 10, 0, 0)), ('cancel_date', datetime.datetime(2015, 3, 10, 0, 0)), ('days_to_cancel', 59), ('is_udacity', True), ('is_canceled', True)])
2017-10-31T14:51:54.000359
Kandis
pythondev_help_Kandis_2017-10-31T14:51:54.000359
1,509,461,514.000359
98,897
pythondev
help
OrderedDict([(‘account_key’, ‘1304’), (‘status’, ‘canceled’), (‘join_date’, datetime.datetime(2015, 1, 10, 0, 0)), (‘cancel_date’, datetime.datetime(2015, 3, 10, 0, 0)), (‘days_to_cancel’, 59), (‘is_udacity’, True), (‘is_canceled’, True)])
2017-10-31T14:51:58.000466
Kandis
pythondev_help_Kandis_2017-10-31T14:51:58.000466
1,509,461,518.000466
98,898
pythondev
help
like this
2017-10-31T14:52:01.000343
Kandis
pythondev_help_Kandis_2017-10-31T14:52:01.000343
1,509,461,521.000343
98,899
pythondev
help
I don’t think so, <@Antionette>, because the original error comes from `non_udacity_enrollments=udacity_removed(enrollments)`
2017-10-31T14:52:19.000444
Meg
pythondev_help_Meg_2017-10-31T14:52:19.000444
1,509,461,539.000444
98,900
pythondev
help
<https://jefflirion.github.io/udacity/Intro_to_Data_Analysis/Lesson1/L1_Starter_Code.html>
2017-10-31T14:53:03.000045
Kandis
pythondev_help_Kandis_2017-10-31T14:53:03.000045
1,509,461,583.000045
98,901
pythondev
help
it is in the “Tracking Down the Remaining Problems”
2017-10-31T14:53:15.000037
Kandis
pythondev_help_Kandis_2017-10-31T14:53:15.000037
1,509,461,595.000037
98,902