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 | <@Desire> you're overriding these values with every run of the loop, it should be something like this:
```
response_list = []
for row in results:
response_list.append({
"date": row[1],
"value": row[3]
})
return Response(response_list)``` | 2017-10-08T07:07:51.000008 | Mirian | pythondev_help_Mirian_2017-10-08T07:07:51.000008 | 1,507,446,471.000008 | 96,403 |
pythondev | help | Thank you so much. | 2017-10-08T07:08:17.000077 | Desire | pythondev_help_Desire_2017-10-08T07:08:17.000077 | 1,507,446,497.000077 | 96,404 |
pythondev | help | you can perhaps tweak it, but this should get you going | 2017-10-08T07:08:37.000057 | Mirian | pythondev_help_Mirian_2017-10-08T07:08:37.000057 | 1,507,446,517.000057 | 96,405 |
pythondev | help | <@Mirian> That helped a lot, kinda stupid of me. | 2017-10-08T07:12:39.000036 | Desire | pythondev_help_Desire_2017-10-08T07:12:39.000036 | 1,507,446,759.000036 | 96,406 |
pythondev | help | no problem :slightly_smiling_face: | 2017-10-08T07:13:58.000040 | Mirian | pythondev_help_Mirian_2017-10-08T07:13:58.000040 | 1,507,446,838.00004 | 96,407 |
pythondev | help | <@Mirian> :taco: | 2017-10-08T07:14:39.000029 | Suellen | pythondev_help_Suellen_2017-10-08T07:14:39.000029 | 1,507,446,879.000029 | 96,408 |
pythondev | help | I have a CSS print media question and not sure where to ask about it, so thought I'd try here... | 2017-10-08T14:38:41.000043 | Jordan | pythondev_help_Jordan_2017-10-08T14:38:41.000043 | 1,507,473,521.000043 | 96,409 |
pythondev | help | I have 3 tables (1 for A grade, B grade, C grade) which contain player name & score. Each table ideally will print on one page in large text. I've got most of this working - but what I'd like is for the table to overflow to the right with additional columns rather than go to a new page | 2017-10-08T14:40:26.000006 | Jordan | pythondev_help_Jordan_2017-10-08T14:40:26.000006 | 1,507,473,626.000006 | 96,410 |
pythondev | help | That hopefully makes my request a bit clearer... | 2017-10-08T14:43:32.000045 | Jordan | pythondev_help_Jordan_2017-10-08T14:43:32.000045 | 1,507,473,812.000045 | 96,411 |
pythondev | help | hi! i want some help in nlp for ranking some document on basis of given feature sets, so is there some algorithm or procedure by which i can achieve my goal <#C07EFMZ1N|help> | 2017-10-08T15:21:55.000003 | Vania | pythondev_help_Vania_2017-10-08T15:21:55.000003 | 1,507,476,115.000003 | 96,412 |
pythondev | help | Hey guys, is this a good way of implementing the singleton pattern? | 2017-10-08T20:26:20.000026 | Micheline | pythondev_help_Micheline_2017-10-08T20:26:20.000026 | 1,507,494,380.000026 | 96,413 |
pythondev | help | but what're you trying to do?, maybe you don't need a singleton after all | 2017-10-09T00:07:46.000097 | Rickey | pythondev_help_Rickey_2017-10-09T00:07:46.000097 | 1,507,507,666.000097 | 96,414 |
pythondev | help | `2017-10-09T06:34:43+00:00` which date format it is and how to turn to a MySQL dateformat? | 2017-10-09T02:49:56.000111 | Pasquale | pythondev_help_Pasquale_2017-10-09T02:49:56.000111 | 1,507,517,396.000111 | 96,415 |
pythondev | help | Hi all, just wanna ask if its possible to make the logout in django.contrib.auth.views method as POST? | 2017-10-09T04:09:25.000136 | Easter | pythondev_help_Easter_2017-10-09T04:09:25.000136 | 1,507,522,165.000136 | 96,416 |
pythondev | help | <https://github.com/django/django/blob/master/django/contrib/auth/views.py#L126> | 2017-10-09T04:12:23.000228 | Vada | pythondev_help_Vada_2017-10-09T04:12:23.000228 | 1,507,522,343.000228 | 96,417 |
pythondev | help | Yep | 2017-10-09T04:12:25.000337 | Vada | pythondev_help_Vada_2017-10-09T04:12:25.000337 | 1,507,522,345.000337 | 96,418 |
pythondev | help | <@Easter> ^^ | 2017-10-09T04:13:07.000164 | Vada | pythondev_help_Vada_2017-10-09T04:13:07.000164 | 1,507,522,387.000164 | 96,419 |
pythondev | help | <@Vada> thanks bro | 2017-10-09T04:14:12.000075 | Easter | pythondev_help_Easter_2017-10-09T04:14:12.000075 | 1,507,522,452.000075 | 96,420 |
pythondev | help | np | 2017-10-09T04:14:17.000437 | Vada | pythondev_help_Vada_2017-10-09T04:14:17.000437 | 1,507,522,457.000437 | 96,421 |
pythondev | help | How can I make t2 and t3 go in background?
``` t2 = Thread(target=first_function))
t3 = Thread(target=second_function)
t2.start()
t3.start()
counter = CHECK_INTERVAL # Reset counter``` | 2017-10-09T08:01:57.000077 | Chaya | pythondev_help_Chaya_2017-10-09T08:01:57.000077 | 1,507,536,117.000077 | 96,422 |
pythondev | help | basically, function is truck, until it done it's job | 2017-10-09T08:02:26.000407 | Chaya | pythondev_help_Chaya_2017-10-09T08:02:26.000407 | 1,507,536,146.000407 | 96,423 |
pythondev | help | I need to find a way, to run multiple functions in background, without waiting until functions returns result | 2017-10-09T08:04:31.000044 | Chaya | pythondev_help_Chaya_2017-10-09T08:04:31.000044 | 1,507,536,271.000044 | 96,424 |
pythondev | help | how is it possible? | 2017-10-09T08:04:35.000153 | Chaya | pythondev_help_Chaya_2017-10-09T08:04:35.000153 | 1,507,536,275.000153 | 96,425 |
pythondev | help | It seems, that threading waits for function to return, then second process is runned | 2017-10-09T08:05:44.000327 | Chaya | pythondev_help_Chaya_2017-10-09T08:05:44.000327 | 1,507,536,344.000327 | 96,426 |
pythondev | help | no, your program doesn't wait for threads (you must use `thread.join()` for this) | 2017-10-09T08:33:02.000295 | Suellen | pythondev_help_Suellen_2017-10-09T08:33:02.000295 | 1,507,537,982.000295 | 96,427 |
pythondev | help | but if your program doesn't have anything else to do, i.e. you launch threads and then it's the end of the program, it won't close until threads are finished | 2017-10-09T08:33:31.000071 | Suellen | pythondev_help_Suellen_2017-10-09T08:33:31.000071 | 1,507,538,011.000071 | 96,428 |
pythondev | help | will block until `t` is finished, because a program is only allowed to exit when all non-daemon threads are finished too
```
def main():
t = Thread(target=...)
print('waiting for t')
``` | 2017-10-09T08:34:28.000481 | Suellen | pythondev_help_Suellen_2017-10-09T08:34:28.000481 | 1,507,538,068.000481 | 96,429 |
pythondev | help | Will not block and will happily exit even when `t` is doing something
```
def main():
t = Thread(target=..., daemon=True)
print('waiting for t')
``` | 2017-10-09T08:35:11.000114 | Suellen | pythondev_help_Suellen_2017-10-09T08:35:11.000114 | 1,507,538,111.000114 | 96,430 |
pythondev | help | Script crashing, and I'm getting this :
```t2 = Thread(target=function(), daemon=True)
TypeError: __init__() got an unexpected keyword argument 'daemon'``` | 2017-10-09T08:45:15.000061 | Chaya | pythondev_help_Chaya_2017-10-09T08:45:15.000061 | 1,507,538,715.000061 | 96,431 |
pythondev | help | strange, there is daemon argument in function call | 2017-10-09T08:45:51.000204 | Chaya | pythondev_help_Chaya_2017-10-09T08:45:51.000204 | 1,507,538,751.000204 | 96,432 |
pythondev | help | `t2 = Thread(target=function, daemon=True)` | 2017-10-09T08:47:09.000171 | Ciera | pythondev_help_Ciera_2017-10-09T08:47:09.000171 | 1,507,538,829.000171 | 96,433 |
pythondev | help | I believe you should pass function and not the result of function | 2017-10-09T08:47:23.000378 | Ciera | pythondev_help_Ciera_2017-10-09T08:47:23.000378 | 1,507,538,843.000378 | 96,434 |
pythondev | help | Yes, I'm passing function | 2017-10-09T08:51:43.000332 | Chaya | pythondev_help_Chaya_2017-10-09T08:51:43.000332 | 1,507,539,103.000332 | 96,435 |
pythondev | help | so you shouldn't put `()` after it. | 2017-10-09T08:52:38.000153 | Ciera | pythondev_help_Ciera_2017-10-09T08:52:38.000153 | 1,507,539,158.000153 | 96,436 |
pythondev | help | Separated function, and function arguments like this
`t2 = Thread(target=function, ags=(arg1, arg2), daemon=True)` | 2017-10-09T08:54:15.000017 | Chaya | pythondev_help_Chaya_2017-10-09T08:54:15.000017 | 1,507,539,255.000017 | 96,437 |
pythondev | help | ok, got it working thanks guys | 2017-10-09T09:04:15.000764 | Chaya | pythondev_help_Chaya_2017-10-09T09:04:15.000764 | 1,507,539,855.000764 | 96,438 |
pythondev | help | im using this <https://pypkg.com/pypi/facebookads/f/facebookads/api.py>
where FacebookResponse is the class
and im just trying to get the Etag, in this way test = FacebookResponse(acccess_token).etag() | 2017-10-09T10:23:08.000376 | Georgetta | pythondev_help_Georgetta_2017-10-09T10:23:08.000376 | 1,507,544,588.000376 | 96,439 |
pythondev | help | but i get 'None' | 2017-10-09T10:23:15.000326 | Georgetta | pythondev_help_Georgetta_2017-10-09T10:23:15.000326 | 1,507,544,595.000326 | 96,440 |
pythondev | help | <@Georgetta> have you read `etag`'s docstring? The corresponding header may be missing, in that case `None` is returned | 2017-10-09T10:30:47.000485 | Collette | pythondev_help_Collette_2017-10-09T10:30:47.000485 | 1,507,545,047.000485 | 96,441 |
pythondev | help | no its doesnt missing because when i tried with curl its work | 2017-10-09T10:35:39.000593 | Georgetta | pythondev_help_Georgetta_2017-10-09T10:35:39.000593 | 1,507,545,339.000593 | 96,442 |
pythondev | help | <@Georgetta>, have you tried making a call that returns a `FacebookResponse` obj? | 2017-10-09T10:40:16.000514 | Winnifred | pythondev_help_Winnifred_2017-10-09T10:40:16.000514 | 1,507,545,616.000514 | 96,443 |
pythondev | help | yes, and it returns the obj | 2017-10-09T10:41:49.000003 | Georgetta | pythondev_help_Georgetta_2017-10-09T10:41:49.000003 | 1,507,545,709.000003 | 96,444 |
pythondev | help | <@Georgetta> can you show us your code? We can't help you without it | 2017-10-09T10:42:27.000356 | Collette | pythondev_help_Collette_2017-10-09T10:42:27.000356 | 1,507,545,747.000356 | 96,445 |
pythondev | help | Can I assume you’re grabbing ad stats? Are you making asynchronous or synchronous calls? | 2017-10-09T10:45:27.000475 | Winnifred | pythondev_help_Winnifred_2017-10-09T10:45:27.000475 | 1,507,545,927.000475 | 96,446 |
pythondev | help | <@Georgetta>, above is how I get headers | 2017-10-09T10:52:00.000432 | Winnifred | pythondev_help_Winnifred_2017-10-09T10:52:00.000432 | 1,507,546,320.000432 | 96,447 |
pythondev | help | <@Winnifred> im using synchronous calls, thanks! | 2017-10-09T10:56:35.000197 | Georgetta | pythondev_help_Georgetta_2017-10-09T10:56:35.000197 | 1,507,546,595.000197 | 96,448 |
pythondev | help | Okay, cool — you should be able to store response from call and access headers via `.headers`. | 2017-10-09T10:57:35.000002 | Winnifred | pythondev_help_Winnifred_2017-10-09T10:57:35.000002 | 1,507,546,655.000002 | 96,449 |
pythondev | help | Whats the best way to turn a list into a dict, when the string of the list is [{'Key': 'somekey', 'Value': 'somevalue'}, {'Key': 'somekey', 'Value': 'somevalue'}] | 2017-10-09T15:19:56.000048 | Johnette | pythondev_help_Johnette_2017-10-09T15:19:56.000048 | 1,507,562,396.000048 | 96,450 |
pythondev | help | casting as a dict, just gives you a dict of {'key': 'Value'} | 2017-10-09T15:20:36.000367 | Johnette | pythondev_help_Johnette_2017-10-09T15:20:36.000367 | 1,507,562,436.000367 | 96,451 |
pythondev | help | you'd have to cast that to multiple dicts | 2017-10-09T15:20:47.000237 | Frieda | pythondev_help_Frieda_2017-10-09T15:20:47.000237 | 1,507,562,447.000237 | 96,452 |
pythondev | help | or make the value a list of values | 2017-10-09T15:20:55.000448 | Frieda | pythondev_help_Frieda_2017-10-09T15:20:55.000448 | 1,507,562,455.000448 | 96,453 |
pythondev | help | Essentially looping through the list and making your own dictionary object? | 2017-10-09T15:21:53.000490 | Johnette | pythondev_help_Johnette_2017-10-09T15:21:53.000490 | 1,507,562,513.00049 | 96,454 |
pythondev | help | I'd probably just use `collections.defaultdict` | 2017-10-09T15:23:25.000225 | Frieda | pythondev_help_Frieda_2017-10-09T15:23:25.000225 | 1,507,562,605.000225 | 96,455 |
pythondev | help | Im not familiar with that module, how would that work in this case? | 2017-10-09T15:33:59.000374 | Johnette | pythondev_help_Johnette_2017-10-09T15:33:59.000374 | 1,507,563,239.000374 | 96,456 |
pythondev | help | this sounds jerky, but go read the docs. there's a whole section of examples that has, from what I can tell, _exactly_ what you're looking for | 2017-10-09T15:35:37.000032 | Frieda | pythondev_help_Frieda_2017-10-09T15:35:37.000032 | 1,507,563,337.000032 | 96,457 |
pythondev | help | like you could copy-and-paste to get 95% of the way there | 2017-10-09T15:35:53.000413 | Frieda | pythondev_help_Frieda_2017-10-09T15:35:53.000413 | 1,507,563,353.000413 | 96,458 |
pythondev | help | <https://docs.python.org/3/library/collections.html?highlight=defaultdict#defaultdict-examples> | 2017-10-09T15:37:52.000380 | Frieda | pythondev_help_Frieda_2017-10-09T15:37:52.000380 | 1,507,563,472.00038 | 96,459 |
pythondev | help | Thanks <@Frieda> that did it. Is there a better syntax way to write this tho keys = dict(d)['Key']
value = dict(d)['Value']
returnDict = dict()
for i in range(0, len(keys)):
returnDict[keys[i]] = value[i] | 2017-10-09T16:02:53.000159 | Johnette | pythondev_help_Johnette_2017-10-09T16:02:53.000159 | 1,507,564,973.000159 | 96,460 |
pythondev | help | you just want to turn your list of dicts into a single dict? | 2017-10-09T16:04:47.000259 | Frieda | pythondev_help_Frieda_2017-10-09T16:04:47.000259 | 1,507,565,087.000259 | 96,461 |
pythondev | help | Whoa, hey <@Frieda>, I'm taking your TTH Python track. I love it! | 2017-10-09T16:09:07.000114 | Nerissa | pythondev_help_Nerissa_2017-10-09T16:09:07.000114 | 1,507,565,347.000114 | 96,462 |
pythondev | help | <@Nerissa> :confetti_ball: glad you're enjoying it! | 2017-10-09T16:09:37.000323 | Frieda | pythondev_help_Frieda_2017-10-09T16:09:37.000323 | 1,507,565,377.000323 | 96,463 |
pythondev | help | Yes basically I have a list that I want a dict. So It has that `'Key': 'somekey', 'Value': 'somevalue'`. I want to turn it into `'somekey': 'somevalue'`. So what I did is this, but I feel its inefficient ```def convertListToDict(tempList):
# Convert the dict to default dictionary
d = defaultdict(list)
for subList in tempList:
for k, v in subList.items():
d[k].append(v)
# Convert default dictionary to dictionary
keys = dict(d)['Key']
value = dict(d)['Value']
returnDict = dict()
for i in range(0, len(keys)):
returnDict[keys[i]] = value[i]
return returnDict``` | 2017-10-09T16:21:27.000325 | Johnette | pythondev_help_Johnette_2017-10-09T16:21:27.000325 | 1,507,566,087.000325 | 96,464 |
pythondev | help | `d = defaultdict(list); d.update(inner_dict for inner_dict in tempList)`? | 2017-10-09T16:23:31.000372 | Frieda | pythondev_help_Frieda_2017-10-09T16:23:31.000372 | 1,507,566,211.000372 | 96,465 |
pythondev | help | and a defaultdict and a dict are exactly the same as far as python in concerned. there's no reason to covert it at the end | 2017-10-09T16:24:18.000054 | Frieda | pythondev_help_Frieda_2017-10-09T16:24:18.000054 | 1,507,566,258.000054 | 96,466 |
pythondev | help | and if you _have_ to convert it (suspicious), `return dict(d)` should be enough | 2017-10-09T16:24:36.000019 | Frieda | pythondev_help_Frieda_2017-10-09T16:24:36.000019 | 1,507,566,276.000019 | 96,467 |
pythondev | help | hmm, ok, maybe it has to do the append | 2017-10-09T16:27:13.000308 | Frieda | pythondev_help_Frieda_2017-10-09T16:27:13.000308 | 1,507,566,433.000308 | 96,468 |
pythondev | help | ```
d = defaultdict(list)
for subdict in tempList:
for k, v in subdict.items():
d[k].append(v)
``` | 2017-10-09T16:27:15.000456 | Frieda | pythondev_help_Frieda_2017-10-09T16:27:15.000456 | 1,507,566,435.000456 | 96,469 |
pythondev | help | Can any one make a suggestion on how to programmatically test all the import statements in a package? | 2017-10-09T16:29:36.000605 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:29:36.000605 | 1,507,566,576.000605 | 96,470 |
pythondev | help | test them how? | 2017-10-09T16:30:08.000032 | Frieda | pythondev_help_Frieda_2017-10-09T16:30:08.000032 | 1,507,566,608.000032 | 96,471 |
pythondev | help | like look for import errors for example | 2017-10-09T16:30:41.000046 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:30:41.000046 | 1,507,566,641.000046 | 96,472 |
pythondev | help | My challenge is as follows | 2017-10-09T16:30:54.000132 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:30:54.000132 | 1,507,566,654.000132 | 96,473 |
pythondev | help | I have a package that relies on many very different 3rd party modules, in essence - we are building API wrappers, then implementing actions e.g. do something with the API wrapper | 2017-10-09T16:31:41.000496 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:31:41.000496 | 1,507,566,701.000496 | 96,474 |
pythondev | help | some are py2, some are py3 | 2017-10-09T16:31:47.000031 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:31:47.000031 | 1,507,566,707.000031 | 96,475 |
pythondev | help | some of these packages don’t work in 2 and 3 | 2017-10-09T16:31:59.000601 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:31:59.000601 | 1,507,566,719.000601 | 96,476 |
pythondev | help | so our module, which has all these classes which are wrappers around APIs | 2017-10-09T16:32:19.000159 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:32:19.000159 | 1,507,566,739.000159 | 96,477 |
pythondev | help | get’s picky depending on py2 or 3 | 2017-10-09T16:32:25.000223 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:32:25.000223 | 1,507,566,745.000223 | 96,478 |
pythondev | help | so we inadvertently break our import statements | 2017-10-09T16:32:38.000296 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:32:38.000296 | 1,507,566,758.000296 | 96,479 |
pythondev | help | always at the worst time | 2017-10-09T16:32:45.000232 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:32:45.000232 | 1,507,566,765.000232 | 96,480 |
pythondev | help | so - I guess I’m asking how to catch this earlier with testing | 2017-10-09T16:33:13.000195 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:33:13.000195 | 1,507,566,793.000195 | 96,481 |
pythondev | help | I’m fully aware there is probably a better solution to my py2-py3 challenges, and we’ve talk about having a separate package/repo for py2 and py3 code, but I’d prefer not it if possible, but since we aren’t just a small module, we are a framework of integrations, it creates these import challenges that I’m admittedly not an expert on | 2017-10-09T16:34:33.000299 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:34:33.000299 | 1,507,566,873.000299 | 96,482 |
pythondev | help | <@Frieda> did help or make my question more ambigious | 2017-10-09T16:35:46.000255 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:35:46.000255 | 1,507,566,946.000255 | 96,483 |
pythondev | help | hmm. you couldn't just figure out which one break on which version and nest their imports under a check against `sys.version_info`? | 2017-10-09T16:37:13.000119 | Frieda | pythondev_help_Frieda_2017-10-09T16:37:13.000119 | 1,507,567,033.000119 | 96,484 |
pythondev | help | <@Frieda> when I dict convert it what happened was I got a dict with the structure of `{"Keys":[], "Value":[]}` | 2017-10-09T16:37:14.000621 | Johnette | pythondev_help_Johnette_2017-10-09T16:37:14.000621 | 1,507,567,034.000621 | 96,485 |
pythondev | help | I’ll add that my module of class wrappers has an __init__.py that has try | except blocks | 2017-10-09T16:37:42.000304 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:37:42.000304 | 1,507,567,062.000304 | 96,486 |
pythondev | help | non-cross-platform-compatible imports co-existing in a single code base is *_HARD_* | 2017-10-09T16:38:19.000274 | Frieda | pythondev_help_Frieda_2017-10-09T16:38:19.000274 | 1,507,567,099.000274 | 96,487 |
pythondev | help | That was bad english.... I had to convert it to a dict from a defaultdict because thats the dictionary I got back ^ | 2017-10-09T16:38:32.000484 | Johnette | pythondev_help_Johnette_2017-10-09T16:38:32.000484 | 1,507,567,112.000484 | 96,488 |
pythondev | help | <@Johnette> hmm, ok. i'm not sure i follow but if you got it working, great | 2017-10-09T16:39:59.000134 | Frieda | pythondev_help_Frieda_2017-10-09T16:39:59.000134 | 1,507,567,199.000134 | 96,489 |
pythondev | help | <@Frieda> yea - that might be a good suggestion | 2017-10-09T16:40:32.000505 | Mohammed | pythondev_help_Mohammed_2017-10-09T16:40:32.000505 | 1,507,567,232.000505 | 96,490 |
pythondev | help | <@Mohammed> you could set up tox to test your codebase w/ both py2 and py3, record the failures and start moving them into try/except or if blocks | 2017-10-09T16:41:00.000007 | Frieda | pythondev_help_Frieda_2017-10-09T16:41:00.000007 | 1,507,567,260.000007 | 96,491 |
pythondev | help | Yeah it works... just not beautiful, but oh well | 2017-10-09T16:41:05.000063 | Johnette | pythondev_help_Johnette_2017-10-09T16:41:05.000063 | 1,507,567,265.000063 | 96,492 |
pythondev | help | <@Johnette> I don't get, say, this line `keys = dict(d)['Key']` | 2017-10-09T16:41:34.000341 | Frieda | pythondev_help_Frieda_2017-10-09T16:41:34.000341 | 1,507,567,294.000341 | 96,493 |
pythondev | help | why convert `d` to a dict to get a key value? you could just do `keys = d['Key']` | 2017-10-09T16:41:52.000438 | Frieda | pythondev_help_Frieda_2017-10-09T16:41:52.000438 | 1,507,567,312.000438 | 96,494 |
pythondev | help | `defaultdict`s are still dicts | 2017-10-09T16:42:00.000074 | Frieda | pythondev_help_Frieda_2017-10-09T16:42:00.000074 | 1,507,567,320.000074 | 96,495 |
pythondev | help | <@Frieda> you're right, corrected | 2017-10-09T16:44:15.000635 | Johnette | pythondev_help_Johnette_2017-10-09T16:44:15.000635 | 1,507,567,455.000635 | 96,496 |
pythondev | help | ```def convertListToDict(tempList):
# Convert the dict to default dictionary
d = defaultdict(list)
for x in tempList:
for k, v in x.items():
d[k].append(v)
# Convert default dictionary to dictionary
keys = d['Key']
value = d['Value']
returnDict = dict()
for i in range(0, len(keys)):
returnDict[keys[i]] = value[i]
return returnDict``` | 2017-10-09T16:45:08.000188 | Johnette | pythondev_help_Johnette_2017-10-09T16:45:08.000188 | 1,507,567,508.000188 | 96,497 |
pythondev | help | `for i, key in enumerate(keys):` | 2017-10-09T16:45:50.000406 | Frieda | pythondev_help_Frieda_2017-10-09T16:45:50.000406 | 1,507,567,550.000406 | 96,498 |
pythondev | help | i might even go further | 2017-10-09T16:46:57.000114 | Frieda | pythondev_help_Frieda_2017-10-09T16:46:57.000114 | 1,507,567,617.000114 | 96,499 |
pythondev | help | `return {key: value[i] for i, key in enumerate(keys)}` | 2017-10-09T16:47:23.000325 | Frieda | pythondev_help_Frieda_2017-10-09T16:47:23.000325 | 1,507,567,643.000325 | 96,500 |
pythondev | help | just eliminate `returnDict` altogether (also, what's up w/ the camelCase for variable names?) | 2017-10-09T16:48:03.000381 | Frieda | pythondev_help_Frieda_2017-10-09T16:48:03.000381 | 1,507,567,683.000381 | 96,501 |
pythondev | help | camel case is how the company does it | 2017-10-09T16:48:23.000163 | Johnette | pythondev_help_Johnette_2017-10-09T16:48:23.000163 | 1,507,567,703.000163 | 96,502 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.