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
<@Bennett> can you post your code in a snippet? It'll be easier to read
2019-03-21T09:10:14.233800
Ashley
pythondev_help_Ashley_2019-03-21T09:10:14.233800
1,553,159,414.2338
14,321
pythondev
help
ok
2019-03-21T09:14:46.234100
Bennett
pythondev_help_Bennett_2019-03-21T09:14:46.234100
1,553,159,686.2341
14,322
pythondev
help
First part
2019-03-21T09:20:20.234400
Bennett
pythondev_help_Bennett_2019-03-21T09:20:20.234400
1,553,160,020.2344
14,323
pythondev
help
What do you mean, more than one value
2019-03-21T09:20:24.234800
Hiroko
pythondev_help_Hiroko_2019-03-21T09:20:24.234800
1,553,160,024.2348
14,324
pythondev
help
second
2019-03-21T09:21:15.234900
Bennett
pythondev_help_Bennett_2019-03-21T09:21:15.234900
1,553,160,075.2349
14,325
pythondev
help
third
2019-03-21T09:21:50.235200
Bennett
pythondev_help_Bennett_2019-03-21T09:21:50.235200
1,553,160,110.2352
14,326
pythondev
help
4th part
2019-03-21T09:22:29.235500
Bennett
pythondev_help_Bennett_2019-03-21T09:22:29.235500
1,553,160,149.2355
14,327
pythondev
help
this is my full code
2019-03-21T09:22:35.235900
Bennett
pythondev_help_Bennett_2019-03-21T09:22:35.235900
1,553,160,155.2359
14,328
pythondev
help
more than value means storing list of values but in mail out put I am getting the last value
2019-03-21T09:23:23.236900
Bennett
pythondev_help_Bennett_2019-03-21T09:23:23.236900
1,553,160,203.2369
14,329
pythondev
help
that is my issue
2019-03-21T09:23:27.237100
Bennett
pythondev_help_Bennett_2019-03-21T09:23:27.237100
1,553,160,207.2371
14,330
pythondev
help
<@Bennett> a snippet is less intrusive and requires less data than screenshots :wink:
2019-03-21T09:24:10.238100
Ashley
pythondev_help_Ashley_2019-03-21T09:24:10.238100
1,553,160,250.2381
14,331
pythondev
help
Paste text, not images
2019-03-21T09:24:21.238500
Hiroko
pythondev_help_Hiroko_2019-03-21T09:24:21.238500
1,553,160,261.2385
14,332
pythondev
help
Hard to read on a phone
2019-03-21T09:24:37.238900
Hiroko
pythondev_help_Hiroko_2019-03-21T09:24:37.238900
1,553,160,277.2389
14,333
pythondev
help
¯\_(ツ)_/¯
2019-03-21T09:24:43.239000
Hiroko
pythondev_help_Hiroko_2019-03-21T09:24:43.239000
1,553,160,283.239
14,334
pythondev
help
Also, you can paste more text than a single screen can show
2019-03-21T09:25:07.239600
Hiroko
pythondev_help_Hiroko_2019-03-21T09:25:07.239600
1,553,160,307.2396
14,335
pythondev
help
snippet
2019-03-21T09:31:49.240000
Bennett
pythondev_help_Bennett_2019-03-21T09:31:49.240000
1,553,160,709.24
14,336
pythondev
help
code
2019-03-21T09:33:24.240600
Bennett
pythondev_help_Bennett_2019-03-21T09:33:24.240600
1,553,160,804.2406
14,337
pythondev
help
code
2019-03-21T09:33:51.240800
Bennett
pythondev_help_Bennett_2019-03-21T09:33:51.240800
1,553,160,831.2408
14,338
pythondev
help
Dat password tho
2019-03-21T09:43:59.243100
Jonas
pythondev_help_Jonas_2019-03-21T09:43:59.243100
1,553,161,439.2431
14,339
pythondev
help
<@Bennett> your code is pretty hard to follow. I would first recommend removing your password, and then changing it immediately (didn't even see it until <@Jonas> mentioned it). Then i would recommend clearing out all the commented code, and then give your variables more meaningful names (e.g. ab, r, i, de, df), and maybe even break out chunks of the coffe code into functions you can give meaningful names to. If I had to guess what's wrong, I'd say you probably aren't appending the value of what you want before you jump to the next value
2019-03-21T09:49:09.248300
Ashley
pythondev_help_Ashley_2019-03-21T09:49:09.248300
1,553,161,749.2483
14,340
pythondev
help
We all trust strangers :parrot_fiesta:
2019-03-21T10:17:02.249000
Contessa
pythondev_help_Contessa_2019-03-21T10:17:02.249000
1,553,163,422.249
14,341
pythondev
help
How to call a .dll file from electron ?(used Python version 3.5+)
2019-03-21T10:30:45.249200
Colton
pythondev_help_Colton_2019-03-21T10:30:45.249200
1,553,164,245.2492
14,342
pythondev
help
Hello, does anybody know of any python “api management platform” similar to <https://www.fusio-project.org/about> (which is php based.) A system that help you build, publish, and manage apis from different data sources, including code
2019-03-21T10:37:04.250900
Luke
pythondev_help_Luke_2019-03-21T10:37:04.250900
1,553,164,624.2509
14,343
pythondev
help
Knowing how to ask a good question is a highly invaluable skill that will benefit you greatly in any career. Two good resources for suggestions and strategies to help you structure and phrase your question to make it easier for those here to understand your problem and help you work to a solution are: • <https://www.mikeash.com/getting_answers.html> • <https://stackoverflow.com/help/how-to-ask>
2019-03-21T10:53:04.251200
Leana
pythondev_help_Leana_2019-03-21T10:53:04.251200
1,553,165,584.2512
14,344
pythondev
help
<@Colton> ^
2019-03-21T10:53:09.251500
Ashley
pythondev_help_Ashley_2019-03-21T10:53:09.251500
1,553,165,589.2515
14,345
pythondev
help
why do people post snippets and delete them....!!?? :smile:
2019-03-21T12:31:47.252500
Merilyn
pythondev_help_Merilyn_2019-03-21T12:31:47.252500
1,553,171,507.2525
14,346
pythondev
help
That one above had a hardcoded password in it
2019-03-21T12:36:14.253100
Hiroko
pythondev_help_Hiroko_2019-03-21T12:36:14.253100
1,553,171,774.2531
14,347
pythondev
help
Riiiiight....!!
2019-03-21T12:37:42.253500
Merilyn
pythondev_help_Merilyn_2019-03-21T12:37:42.253500
1,553,171,862.2535
14,348
pythondev
help
im having an issue converting a dictionary to a dataframe. My dictionary is very small, but includes lists within their respective keys. its returning an error 'int object has no len()'. not sure how to go about fixing this one :thinking_face:
2019-03-21T13:31:49.254600
Nenita
pythondev_help_Nenita_2019-03-21T13:31:49.254600
1,553,175,109.2546
14,349
pythondev
help
I assume you have tried pandas.DataFrame.from_dict(). The error looks like your code thinks that all elements are iterables. Maybe you can normalize all integers to lists? Instead of the number 5, transform it to [5] and so on?
2019-03-21T13:38:58.256700
Contessa
pythondev_help_Contessa_2019-03-21T13:38:58.256700
1,553,175,538.2567
14,350
pythondev
help
<@Nenita> what have you tried? Can you provide an example of what your data looks like?
2019-03-21T13:43:06.257500
Marth
pythondev_help_Marth_2019-03-21T13:43:06.257500
1,553,175,786.2575
14,351
pythondev
help
None
2019-03-21T13:45:10.257600
Nenita
pythondev_help_Nenita_2019-03-21T13:45:10.257600
1,553,175,910.2576
14,352
pythondev
help
sounds like the `total` is throwing things off
2019-03-21T13:45:58.258100
Hiroko
pythondev_help_Hiroko_2019-03-21T13:45:58.258100
1,553,175,958.2581
14,353
pythondev
help
yea, thats what i was thinking when i was stepping through it. i just dont know how to single out the total to be a different dtype
2019-03-21T13:46:18.258700
Nenita
pythondev_help_Nenita_2019-03-21T13:46:18.258700
1,553,175,978.2587
14,354
pythondev
help
that;s the only kv pair that isn’t a string-list
2019-03-21T13:46:20.258900
Hiroko
pythondev_help_Hiroko_2019-03-21T13:46:20.258900
1,553,175,980.2589
14,355
pythondev
help
Hi all - I have a little ’test’ method which compares the returned value to the expected value of a function and prints “Ok” or “X”. I am passing the function into the test method as an argument, but would also like to print out it’s running time. It seems like the function is being executed before the ‘test’ method even starts running (based on debugging print statements), so I am not sure if the “start time” is correct. Is there a clean and accurate way to calculate the running time of the function this way?
2019-03-21T13:55:33.259000
Deeanna
pythondev_help_Deeanna_2019-03-21T13:55:33.259000
1,553,176,533.259
14,356
pythondev
help
<@Nenita> not sure the specific situation, but if it was me, I'd delete/drop the Total from the dict, read in the dict, and then use pandas to calculate any totals I needed
2019-03-21T14:08:41.260500
Marth
pythondev_help_Marth_2019-03-21T14:08:41.260500
1,553,177,321.2605
14,357
pythondev
help
I could see that as a work around. I just created a list out of the values in the dict and then appended that into the df. works well enough.
2019-03-21T14:09:50.261400
Nenita
pythondev_help_Nenita_2019-03-21T14:09:50.261400
1,553,177,390.2614
14,358
pythondev
help
<@Deeanna> Consider using the timeit module. <https://www.pythoncentral.io/time-a-python-function/>
2019-03-21T14:12:45.262600
Corina
pythondev_help_Corina_2019-03-21T14:12:45.262600
1,553,177,565.2626
14,359
pythondev
help
<@Corina> thank you!
2019-03-21T14:15:48.263000
Deeanna
pythondev_help_Deeanna_2019-03-21T14:15:48.263000
1,553,177,748.263
14,360
pythondev
help
it's handwritten signature. and yes, it is part of the image along with some other text.
2019-03-21T14:48:31.263200
Retta
pythondev_help_Retta_2019-03-21T14:48:31.263200
1,553,179,711.2632
14,361
pythondev
help
problem was solved when I logged into the remote machine using an unrestricted network and opened port 443 in sshd_config file
2019-03-21T17:37:56.263900
Elmo
pythondev_help_Elmo_2019-03-21T17:37:56.263900
1,553,189,876.2639
14,362
pythondev
help
after that it worked fine on my campus’s restricted network too :gavel_parrot:
2019-03-21T17:39:04.264100
Elmo
pythondev_help_Elmo_2019-03-21T17:39:04.264100
1,553,189,944.2641
14,363
pythondev
help
Hi. Why does the 'train_on_cpu' function cell actually execute instead of just creating the function defintion and then moving to the next cell where it actually called ? in other words, how does a function execute without being properly called ? <https://github.com/paulgureghian/CatBoost/blob/master/CatBoost.ipynb>
2019-03-21T19:53:17.268100
Clayton
pythondev_help_Clayton_2019-03-21T19:53:17.268100
1,553,197,997.2681
14,364
pythondev
help
It looks like it is called - in `cpu_time = timeit.timeit('train_on_cpu'()...` as well as later `source: train_on_cpu()`
2019-03-21T20:08:05.270400
Clemmie
pythondev_help_Clemmie_2019-03-21T20:08:05.270400
1,553,198,885.2704
14,365
pythondev
help
I see that. I haven't seen a lot of code where the function gets called as part of the definition of a varible / object.
2019-03-21T20:12:24.271600
Clayton
pythondev_help_Clayton_2019-03-21T20:12:24.271600
1,553,199,144.2716
14,366
pythondev
help
setting a variable to the returned value of a function call is common
2019-03-21T21:00:42.272600
Clemmie
pythondev_help_Clemmie_2019-03-21T21:00:42.272600
1,553,202,042.2726
14,367
pythondev
help
Im trying to think of the best way to create an ` if ` statement in a loop inside of a function. I need the if statement to say if the collection of values for key are 8 apply the rest to the other keys. Here is my function:
2019-03-21T21:29:20.275100
Juliana
pythondev_help_Juliana_2019-03-21T21:29:20.275100
1,553,203,760.2751
14,368
pythondev
help
Hi Guys! I want to view some geographical points on the map. I was using folium, but it only works with the jupyter notebook. Do you know any other libraries to view some points on the map and save map to the file in python?
2019-03-21T21:41:39.276800
Angelita
pythondev_help_Angelita_2019-03-21T21:41:39.276800
1,553,204,499.2768
14,369
pythondev
help
you can always output map to html from folium if use case permits
2019-03-21T22:50:46.277100
Raguel
pythondev_help_Raguel_2019-03-21T22:50:46.277100
1,553,208,646.2771
14,370
pythondev
help
How to interpret ([ format in python documentation. for eg: str.endswith(suffix[, start[, end]]) . I know what this function does, but I am not able to understand the representation used ( and [
2019-03-22T00:08:14.278000
Ok
pythondev_help_Ok_2019-03-22T00:08:14.278000
1,553,213,294.278
14,371
pythondev
help
The parentheses just mean a function call. The brackets indicate that the parameter is optional.
2019-03-22T00:11:03.278700
Sasha
pythondev_help_Sasha_2019-03-22T00:11:03.278700
1,553,213,463.2787
14,372
pythondev
help
So you could call it by `endswith(suffix)`, or `endswith(suffix, start)`, or `endswith(suffix, start, end)`.
2019-03-22T00:12:28.279700
Sasha
pythondev_help_Sasha_2019-03-22T00:12:28.279700
1,553,213,548.2797
14,373
pythondev
help
I'm having an issue here after adding an argparse argument that includes nargs='+' attribute. in some cases i may provide more than one attribute, others a single attribute. i'm having an issue when i only provide a single attribute as it creates it as a list but I need it to be a string. I've tried a variety of things with no luck, the latest attempt was `s = ''.join(map(str, symbol[0]))` which outputs something like this: ``` ""","2019-03-21 14:15:00",21.0250,21.0250,21.0250,21.0250,211 ""","2019-03-21 14:13:00",21.0100,21.0100,21.0100,21.0100,3298 ""","2019-03-21 14:12:00",21.0200,21.0200,21.0200,21.0200,621 ``` otherwise it does something real wonky like this (the last few lines): ``` """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""PVTL"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""","2019-03-21 14:15:00",21.0250,21.0250,21.0250,21.0250,211 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""PVTL""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""","2019-03-21 14:13:00",21.0100,21.0100,21.0100,21.0100,3298 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""PVTL"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""","2019-03-21 14:12:00",21.0200,21.0200,21.0200,21.0200,621 ``` I can't seem to use the first element of the list symbol[0] or convert it to a string for some reason. Code is like this: ``` for i, v in enumerate(data): if i == 0: s = 'symbol' v.insert(0, s) v = ",".join(v) print(v) elif i &gt; 0: #s = ''.join(symbol) #s = str(symbol[0]) #s = ''.join([str(x) for x in symbol]) s = ''.join(map(str, symbol[0])) ##print(type(symbol)) ##print(len(symbol)) ##print(symbol[0]) ##break #s = symbol[0] symbol = '"{}"'.format(s) v[0] = '"{}"'.format(v[0]) v[0] = '{}'.format(v[0]) v.insert(0, symbol) v = ",".join(v) print(v) ```
2019-03-22T00:16:35.282600
Stacy
pythondev_help_Stacy_2019-03-22T00:16:35.282600
1,553,213,795.2826
14,374
pythondev
help
all the extra quotes are stemming from this line: `symbol = '"{}"'.format(s)` before i added argparse this worked fine.
2019-03-22T00:18:18.283200
Stacy
pythondev_help_Stacy_2019-03-22T00:18:18.283200
1,553,213,898.2832
14,375
pythondev
help
argparse line: `parser.add_argument('-s', '--symbol', nargs='+', help="stock symbol", required=True) `
2019-03-22T00:20:12.283500
Stacy
pythondev_help_Stacy_2019-03-22T00:20:12.283500
1,553,214,012.2835
14,376
pythondev
help
`symbol = args.symbol`
2019-03-22T00:20:28.284000
Stacy
pythondev_help_Stacy_2019-03-22T00:20:28.284000
1,553,214,028.284
14,377
pythondev
help
I'm finding it a little difficult to follow your question. Can you show me what `symbol` prints as when returned by argparse, and what you want it to be instead?
2019-03-22T00:21:00.284600
Sasha
pythondev_help_Sasha_2019-03-22T00:21:00.284600
1,553,214,060.2846
14,378
pythondev
help
yep one sec
2019-03-22T00:21:18.284800
Stacy
pythondev_help_Stacy_2019-03-22T00:21:18.284800
1,553,214,078.2848
14,379
pythondev
help
it is difficult, i use awful variable names, sorry.
2019-03-22T00:21:32.285100
Stacy
pythondev_help_Stacy_2019-03-22T00:21:32.285100
1,553,214,092.2851
14,380
pythondev
help
``` 22:12 $ python stocks2.py -s PVTL -t intraday symbol,timestamp,open,high,low,close,volume &lt;class 'list'&gt; 1 PVTL ```
2019-03-22T00:22:22.285300
Stacy
pythondev_help_Stacy_2019-03-22T00:22:22.285300
1,553,214,142.2853
14,381
pythondev
help
i want a line to look like this: `"PVTL","2019-03-21 14:12:00",21.0200,21.0200,21.0200,21.0200,621`
2019-03-22T00:22:49.285800
Stacy
pythondev_help_Stacy_2019-03-22T00:22:49.285800
1,553,214,169.2858
14,382
pythondev
help
the output above is from: ``` print(type(symbol)) print(len(symbol)) print(symbol[0]) ```
2019-03-22T00:23:25.286100
Stacy
pythondev_help_Stacy_2019-03-22T00:23:25.286100
1,553,214,205.2861
14,383
pythondev
help
So it looks like `symbol[0]` is what you want, and the `'"{}"'.format(symbol[0])` should work. Can you clarify how that broke?
2019-03-22T00:24:25.287300
Sasha
pythondev_help_Sasha_2019-03-22T00:24:25.287300
1,553,214,265.2873
14,384
pythondev
help
``` for i, v in enumerate(data): if i == 0: s = 'symbol' v.insert(0, s) v = ",".join(v) print(v) elif i &gt; 0: symbol = '"{}"'.format(symbol[0]) v[0] = '"{}"'.format(v[0]) v[0] = '{}'.format(v[0]) v.insert(0, symbol) v = ",".join(v) print(v) ``` The lines look like this, like it's adding an extra quote, or extra empty quotes: Example lines: ``` ""","2019-03-21 14:15:00",21.0250,21.0250,21.0250,21.0250,211 ""","2019-03-21 14:13:00",21.0100,21.0100,21.0100,21.0100,3298 ""","2019-03-21 14:12:00",21.0200,21.0200,21.0200,21.0200,621 ```
2019-03-22T00:26:44.288300
Stacy
pythondev_help_Stacy_2019-03-22T00:26:44.288300
1,553,214,404.2883
14,385
pythondev
help
So you seem to be reassigning the `symbol` variable in the line after the `elif`, which means that `symbol[0]` gets to become the quotation mark from `"PVTL"` on subsequent passes through the loop.
2019-03-22T00:28:42.289600
Sasha
pythondev_help_Sasha_2019-03-22T00:28:42.289600
1,553,214,522.2896
14,386
pythondev
help
oh, yeah, here's the top of the output: ``` symbol,timestamp,open,high,low,close,volume "PVTL","2019-03-21 16:00:00",21.4000,21.4100,21.3600,21.3900,53672 ""","2019-03-21 15:59:00",21.3900,21.3950,21.3900,21.3950,26517 ```
2019-03-22T00:29:17.289900
Stacy
pythondev_help_Stacy_2019-03-22T00:29:17.289900
1,553,214,557.2899
14,387
pythondev
help
So your main problem is variable naming.
2019-03-22T00:29:32.290300
Sasha
pythondev_help_Sasha_2019-03-22T00:29:32.290300
1,553,214,572.2903
14,388
pythondev
help
Sorry, was that clear enough to indicate how to fix things, or should I be more explicit?
2019-03-22T00:33:46.290900
Sasha
pythondev_help_Sasha_2019-03-22T00:33:46.290900
1,553,214,826.2909
14,389
pythondev
help
ughhhh. i got it. so this is what I ended up with. so after fixing variable `s` it was the `#v.insert(0, symbol)` line breaking things. ``` s = '"{}"'.format(symbol[0]) v[0] = '"{}"'.format(v[0]) v[0] = '{}'.format(v[0]) #v.insert(0, symbol) v.insert(0, s) v = ",".join(v) print(v) ``` took me a minute after your response but that was the nudge I needed.
2019-03-22T00:36:12.292500
Stacy
pythondev_help_Stacy_2019-03-22T00:36:12.292500
1,553,214,972.2925
14,390
pythondev
help
thank you, as always, <@Sasha> :taco: :taco: :taco:
2019-03-22T00:36:29.293000
Stacy
pythondev_help_Stacy_2019-03-22T00:36:29.293000
1,553,214,989.293
14,391
pythondev
help
Great! By the way, the `v[0] = '{}'.format(v[0])` line doesn't do anything in this case, since it's just re-formatting the value as itself.
2019-03-22T00:38:02.294200
Sasha
pythondev_help_Sasha_2019-03-22T00:38:02.294200
1,553,215,082.2942
14,392
pythondev
help
yep, absolutely right. not sure what that's doing there. haha, only the first two columns need to be quoted in doubles just like this `"PVTL","2019-03-21 14:12:00",21.0200,21.0200,21.0200,21.0200,621`. thanks for catching that as well.
2019-03-22T00:39:18.295100
Stacy
pythondev_help_Stacy_2019-03-22T00:39:18.295100
1,553,215,158.2951
14,393
pythondev
help
made a lot of progress with this today, that was the last problem. :smile: very much appreciate the assistance.
2019-03-22T00:39:58.295800
Stacy
pythondev_help_Stacy_2019-03-22T00:39:58.295800
1,553,215,198.2958
14,394
pythondev
help
Maybe it's more appropriate for <#C07EFMZ1N|help>
2019-03-22T03:15:09.296700
Russ
pythondev_help_Russ_2019-03-22T03:15:09.296700
1,553,224,509.2967
14,395
pythondev
help
It seems there is no mistakes in the code.please check your database connection again and try <@Russ>
2019-03-22T03:28:59.297100
Donny
pythondev_help_Donny_2019-03-22T03:28:59.297100
1,553,225,339.2971
14,396
pythondev
help
It works fine first couple of hours, but I noticed that the next day I get "connection lost".. weird. I thought maybe it has something to do with opening/closing connection or cursor.
2019-03-22T03:32:02.299500
Russ
pythondev_help_Russ_2019-03-22T03:32:02.299500
1,553,225,522.2995
14,397
pythondev
help
Hello! How can I create python string that has every character 2 or 4byte wide?
2019-03-22T04:05:07.300600
Debbie
pythondev_help_Debbie_2019-03-22T04:05:07.300600
1,553,227,507.3006
14,398
pythondev
help
Only the characters in UTF-8 that would take up 2 or 4 bytes?
2019-03-22T04:18:38.301700
Yaeko
pythondev_help_Yaeko_2019-03-22T04:18:38.301700
1,553,228,318.3017
14,399
pythondev
help
Based on this <https://stackoverflow.com/a/44776334>, it should be possible to generate all possible characters, convert the binary to hex and then to a character.
2019-03-22T04:29:00.302400
Yaeko
pythondev_help_Yaeko_2019-03-22T04:29:00.302400
1,553,228,940.3024
14,400
pythondev
help
<@Debbie> ^
2019-03-22T04:38:28.302800
Jettie
pythondev_help_Jettie_2019-03-22T04:38:28.302800
1,553,229,508.3028
14,401
pythondev
help
Thanks, will read :)
2019-03-22T04:38:46.303100
Debbie
pythondev_help_Debbie_2019-03-22T04:38:46.303100
1,553,229,526.3031
14,402
pythondev
help
If I want a program to sleep for 7 minutes, so I need to create a loop with the `time.sleep` function like so; ``` import time for x in range(7): time.sleep(60) ``` Or is there a more efficient way?
2019-03-22T05:12:47.304700
Arturo
pythondev_help_Arturo_2019-03-22T05:12:47.304700
1,553,231,567.3047
14,403
pythondev
help
time.sleep(60*7)
2019-03-22T05:29:40.306100
Antoine
pythondev_help_Antoine_2019-03-22T05:29:40.306100
1,553,232,580.3061
14,404
pythondev
help
I'm having issues with pyodbc and fast_executemany. When inserting rows it sometimes corrupts memory and sometimes complains about string truncation. I've found some info on it like here <https://github.com/mkleehammer/pyodbc/issues/380>, but while some solutions are merged, i still have the issue. Using pyodbc 4.0.26. Everything works fine if i disable fast_executemany, but the whole point of using it is that it's otherwise too slow. Anyone any ideas on how to sovle this?
2019-03-22T05:30:27.307200
Dawn
pythondev_help_Dawn_2019-03-22T05:30:27.307200
1,553,232,627.3072
14,405
pythondev
help
The loop thing is better in my opinion, since it allows for interrupting the loop with, for example KeyboardInterrupt
2019-03-22T05:32:54.307700
Yaeko
pythondev_help_Yaeko_2019-03-22T05:32:54.307700
1,553,232,774.3077
14,406
pythondev
help
Or if you are running multi-threaded things and sets some flags for exiting it can do so in between loops instead of hanging there for 7 minutes.
2019-03-22T05:33:45.308000
Yaeko
pythondev_help_Yaeko_2019-03-22T05:33:45.308000
1,553,232,825.308
14,407
pythondev
help
Ah, so bypassing your proxying tool altogether? That'll work! :smile:
2019-03-22T05:49:35.308200
Melynda
pythondev_help_Melynda_2019-03-22T05:49:35.308200
1,553,233,775.3082
14,408
pythondev
help
Please, stop
2019-03-22T06:28:34.312300
Chester
pythondev_help_Chester_2019-03-22T06:28:34.312300
1,553,236,114.3123
14,409
pythondev
help
Sorry for the spam guys, it was obviously a mistake :neutral_face:
2019-03-22T06:30:39.314100
Contessa
pythondev_help_Contessa_2019-03-22T06:30:39.314100
1,553,236,239.3141
14,410
pythondev
help
it doesn't matter, interruptions work even if the thread is busy `sleep`ing
2019-03-22T07:25:28.314500
Jettie
pythondev_help_Jettie_2019-03-22T07:25:28.314500
1,553,239,528.3145
14,411
pythondev
help
You are right, interruptions works regardless. But if set some signal to exit it gracefully, that would not work if it is sleeping.
2019-03-22T07:47:50.314700
Yaeko
pythondev_help_Yaeko_2019-03-22T07:47:50.314700
1,553,240,870.3147
14,412
pythondev
help
<@Jettie> :taco: for correcting incorect advice.
2019-03-22T07:48:14.314900
Yaeko
pythondev_help_Yaeko_2019-03-22T07:48:14.314900
1,553,240,894.3149
14,413
pythondev
help
i have two lists of columns and i want to combine them into one string to dynamically create an update statement for sql. so i have columns = ['ID', 'CreatedAt', 'Note'] merge_columns = ['Source.ID', 'Source.'CreatedAt', 'Source.Note'] equal_signs = ['=', '=', '='] the output should be `ID=Source.ID, CreatedAt=Source.CreatedAt, Note=Source.Note`. so i thought maybe do zip(columns, equal_signs, merge_columns) and then turn it into a string, maybe by joining the zipped columns ", ".join(zipped_lists), but that doesn't work. anyone a better solution?
2019-03-22T09:04:41.316400
Dawn
pythondev_help_Dawn_2019-03-22T09:04:41.316400
1,553,245,481.3164
14,414
pythondev
help
actually, zip returns a generator, each step is a three tuple with your example
2019-03-22T09:10:39.318400
Hiroko
pythondev_help_Hiroko_2019-03-22T09:10:39.318400
1,553,245,839.3184
14,415
pythondev
help
so you need to join the tuples before making the list
2019-03-22T09:10:48.318700
Hiroko
pythondev_help_Hiroko_2019-03-22T09:10:48.318700
1,553,245,848.3187
14,416
pythondev
help
you’re almost there, just need one step further
2019-03-22T09:10:56.319100
Hiroko
pythondev_help_Hiroko_2019-03-22T09:10:56.319100
1,553,245,856.3191
14,417
pythondev
help
```In [7]: list(zip(columns, equal_signs, merge_columns)) Out[7]: [('ID', '=', 'Source.ID'), ('CreatedAt', '=', 'Source.CreatedAt'), ('Note', '=', 'Source.Note')] ```
2019-03-22T09:11:03.319400
Hiroko
pythondev_help_Hiroko_2019-03-22T09:11:03.319400
1,553,245,863.3194
14,418
pythondev
help
note the list triggers an eval and exhaustion of the zip generator
2019-03-22T09:11:25.320000
Hiroko
pythondev_help_Hiroko_2019-03-22T09:11:25.320000
1,553,245,885.32
14,419
pythondev
help
The equals sign list seems unnecessary, since it will always be the same for every column pair, but zip is a good first step either way
2019-03-22T09:12:48.321600
Ashley
pythondev_help_Ashley_2019-03-22T09:12:48.321600
1,553,245,968.3216
14,420