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
:taco: <@Johana>
2017-09-04T13:22:27.000122
Lana
pythondev_help_Lana_2017-09-04T13:22:27.000122
1,504,531,347.000122
92,103
pythondev
help
it’s just experience :wink:.
2017-09-04T13:24:27.000045
Johana
pythondev_help_Johana_2017-09-04T13:24:27.000045
1,504,531,467.000045
92,104
pythondev
help
you’ll get there.
2017-09-04T13:24:30.000207
Johana
pythondev_help_Johana_2017-09-04T13:24:30.000207
1,504,531,470.000207
92,105
pythondev
help
you may also want to start introducing some assumptions for sanity’s sake.
2017-09-04T13:25:21.000054
Johana
pythondev_help_Johana_2017-09-04T13:25:21.000054
1,504,531,521.000054
92,106
pythondev
help
for example an app/script that finds things in bible xml should be able to safely assume where the files are located…
2017-09-04T13:25:54.000060
Johana
pythondev_help_Johana_2017-09-04T13:25:54.000060
1,504,531,554.00006
92,107
pythondev
help
i think having to specify the full_path is unnecessary. could offer a way for the user to override this behavior by doing this: ``` def __init__(self, xml_path=None): if xml_path: self.xml_path = xml_path else: self.xml_path = '/path/to/file' ```
2017-09-04T13:28:37.000027
Johana
pythondev_help_Johana_2017-09-04T13:28:37.000027
1,504,531,717.000027
92,108
pythondev
help
Sounds awesome...
2017-09-04T13:29:27.000211
Lana
pythondev_help_Lana_2017-09-04T13:29:27.000211
1,504,531,767.000211
92,109
pythondev
help
And, about the experience, I have ~1 year and... Nothing I can say :stuck_out_tongue:
2017-09-04T13:29:50.000037
Lana
pythondev_help_Lana_2017-09-04T13:29:50.000037
1,504,531,790.000037
92,110
pythondev
help
scripts never die so it’s best to design them in a way you can run them and they work for the most part b/c 3 months from now you might not remember :wink:.
2017-09-04T13:30:37.000138
Johana
pythondev_help_Johana_2017-09-04T13:30:37.000138
1,504,531,837.000138
92,111
pythondev
help
i love having defaults that just work.
2017-09-04T13:30:54.000173
Johana
pythondev_help_Johana_2017-09-04T13:30:54.000173
1,504,531,854.000173
92,112
pythondev
help
The Bible was written in XML?
2017-09-04T15:29:12.000058
Sidney
pythondev_help_Sidney_2017-09-04T15:29:12.000058
1,504,538,952.000058
92,113
pythondev
help
TIL
2017-09-04T15:29:32.000110
Sidney
pythondev_help_Sidney_2017-09-04T15:29:32.000110
1,504,538,972.00011
92,114
pythondev
help
Think it was originally written in YAML and King James converted it to XML
2017-09-04T15:45:14.000027
Britteny
pythondev_help_Britteny_2017-09-04T15:45:14.000027
1,504,539,914.000027
92,115
pythondev
help
Hello, I have mind problem with TDD using mock. I can't just break through this: How can I write test before my code using mocking if I'm not exactly sure what I want to use? It's nice when You're testing behavior of something but when it comes to use some side-effect generating objects it's unbreakable wall for me. I know how to write unittest, mock things .etc but I don't really know how to do testing before code when I'm not sure what will fit best. For example when I'm using paramiko to do some sftp staff I simply can't predict every thing I do because I don't really know this lib enough. (Well, I know paramiko, this is just example :D) When I'm trying stuff and checking how it works... well I'm ending up with already created solution... and then pre-testing is becoming a post-testing which shouldn't be done in TDD halp :confused:
2017-09-04T16:32:44.000095
Carie
pythondev_help_Carie_2017-09-04T16:32:44.000095
1,504,542,764.000095
92,116
pythondev
help
<@Carie> I think you'd generally do best by "wrapping" the external lib and then testing those functions, you can define a noop function and write tests around it (obviously they fail immediately). Then you integrate the external lib into those functions (so none of your main app code uses the external lib, since that's an "implementation detail") and keep going until it's passing.
2017-09-04T17:00:38.000150
Beula
pythondev_help_Beula_2017-09-04T17:00:38.000150
1,504,544,438.00015
92,117
pythondev
help
hi guys, quick question, im trying to make a really simple crud api. does this make sense? ``` CREATE AN ALBUM album/create/{artist_id}/{album_id} return all albums with artist name, album name, genre, year with the new album DELETE AN ALBUM BY ALBUM ID album/{album_id} =returns albumin, album name, artist name, genre, year that was deleted PUT/UPDATE AN ALBUM BY ALBUM ID album/{album_id} =returns reads all albums with artist name, album name, genre, year with the updated version (for each artists with multiple albums are grouped together) GET/READ AN ALBUM album/{album_id} =returns reads album name, artist name, genre, year that was deleted 1: { albumName: ['Do You Wanna Know', 'Some Other Album'] artistName: 'Arctic Monkeys', Genre: 'Rock' ] ```
2017-09-04T23:27:35.000140
Eartha
pythondev_help_Eartha_2017-09-04T23:27:35.000140
1,504,567,655.00014
92,118
pythondev
help
<@Eartha> if you wanna make rest api I’d recommend you don’t use verbs in urls and use http methods instead
2017-09-05T02:39:57.000163
Luana
pythondev_help_Luana_2017-09-05T02:39:57.000163
1,504,579,197.000163
92,119
pythondev
help
`from typing import Iterable, Iterator, Sequence` An iterator describes the actual iterator object (e.g. what you get back when you run `iter(some_list)`). An Iterable is some object `xs` that you can do `for x in xs: ...` A Sequence describes an object `xs` that is an Iterable that also allows you to grab a specific element, e.g. `xs[4]` (that is, xs has a `__getitem__` method defined). An Iterable MAY have `__getitem__`, but a Sequence MUST have it. Correct?
2017-09-05T05:05:56.000023
Lanita
pythondev_help_Lanita_2017-09-05T05:05:56.000023
1,504,587,956.000023
92,120
pythondev
help
So, when I'm annotating a function, I could use Iterable if I want some duck typing and I know that I won't be accessing a specific member of the object, but I have to use Sequence if I ever access a specific member (e.g. I'll run `xs[-1]` at some point, if xs is the object we're annotating)
2017-09-05T05:07:30.000033
Lanita
pythondev_help_Lanita_2017-09-05T05:07:30.000033
1,504,588,050.000033
92,121
pythondev
help
seems correct
2017-09-05T05:08:40.000094
Ciera
pythondev_help_Ciera_2017-09-05T05:08:40.000094
1,504,588,120.000094
92,122
pythondev
help
This is all in the context of type annotations btw, which is why the official definitions as found in the docs might not match up
2017-09-05T05:09:13.000129
Lanita
pythondev_help_Lanita_2017-09-05T05:09:13.000129
1,504,588,153.000129
92,123
pythondev
help
I really wish that the Callable type annotation was more advanced... It'd be cool if I could for example create a NewType for a Django view function, being a "Callable whose first argument is HttpRequest, ignoring all the other aspects". Right now the annotation is `Callable[[arg1, arg2], return_type]`, but there's no way of doing e.g. `Callable[[HttpRequest, ...], Any]`
2017-09-05T05:11:59.000279
Lanita
pythondev_help_Lanita_2017-09-05T05:11:59.000279
1,504,588,319.000279
92,124
pythondev
help
<@Lanita> why would you annotate a django's view function?
2017-09-05T05:15:18.000362
Collette
pythondev_help_Collette_2017-09-05T05:15:18.000362
1,504,588,518.000362
92,125
pythondev
help
<@Collette>, it would make it clearer when writing e.g. decorators
2017-09-05T05:18:51.000221
Lanita
pythondev_help_Lanita_2017-09-05T05:18:51.000221
1,504,588,731.000221
92,126
pythondev
help
<@Lanita> this is a very, very specific use-case. I doubt it's worth it to introduce a custom syntax to handle this case (imo, a good type checker should infer all necessary information automatically), but you can always open a feature request
2017-09-05T05:56:14.000181
Collette
pythondev_help_Collette_2017-09-05T05:56:14.000181
1,504,590,974.000181
92,127
pythondev
help
<@Collette> No, it's not anywhere near "very very" user specific. This is a standard part of python function definition syntax. E.g. doing `def f(some_arg, *rest_of_args)`
2017-09-05T06:40:20.000328
Lanita
pythondev_help_Lanita_2017-09-05T06:40:20.000328
1,504,593,620.000328
92,128
pythondev
help
Being able to annotate that function as `Callable[[type(some_arg), ...], Any]` would be neat
2017-09-05T06:40:52.000399
Lanita
pythondev_help_Lanita_2017-09-05T06:40:52.000399
1,504,593,652.000399
92,129
pythondev
help
It's also common when "overloading" methods in classes, e.g. class A has `def some_method(arg1)`, class B which inherits from class A has `def some_method(arg1, extra_arg)`
2017-09-05T06:42:28.000097
Lanita
pythondev_help_Lanita_2017-09-05T06:42:28.000097
1,504,593,748.000097
92,130
pythondev
help
example of similar things proposed: <https://github.com/python/mypy/issues/3157>
2017-09-05T06:49:07.000230
Lanita
pythondev_help_Lanita_2017-09-05T06:49:07.000230
1,504,594,147.00023
92,131
pythondev
help
<@Lanita> you're implying that type annotations should be everywhere. No, they don't. It would be good if `typing` would support that use-case, but to me it doesn't seem so much critical at all.
2017-09-05T07:47:10.000032
Collette
pythondev_help_Collette_2017-09-05T07:47:10.000032
1,504,597,630.000032
92,132
pythondev
help
That's why I proposed you to create a feature request, and looks like it's created already by someone else
2017-09-05T07:47:30.000072
Collette
pythondev_help_Collette_2017-09-05T07:47:30.000072
1,504,597,650.000072
92,133
pythondev
help
Well multiple people clearly think otherwise, as proven by the various issues on mypy with positive response regarding this subject...
2017-09-05T07:47:55.000127
Lanita
pythondev_help_Lanita_2017-09-05T07:47:55.000127
1,504,597,675.000127
92,134
pythondev
help
Even more people haven't participated in these issues, who may have another opinion. But let's not discuss that. Again, I'm not against this feature. I just think that a) annotating everything will destroy one of the most important features of python (to me) - readability, b) therefore it would be better to improve static type checkers to infer as much as possible; c) however, I think we can live without type checking in this specific use-case because we lived without `typing` module for a quite long time and sky didn't fall, but d) it won't hurt anyone if this feature is supported. Some folks will definitely find it useful.
2017-09-05T07:52:19.000006
Collette
pythondev_help_Collette_2017-09-05T07:52:19.000006
1,504,597,939.000006
92,135
pythondev
help
I have a string with a method name in it, I'm looking for a way to call that function on an instanced object identifying the method by the name of the string. This somewhat works, but is ugly as can be: ```instance.__class__.__dict__[method_name](instance)``` Except, these are inherited objects, and inherited methods aren't accessible. There must be a better way.
2017-09-05T14:09:09.000119
Meghan
pythondev_help_Meghan_2017-09-05T14:09:09.000119
1,504,620,549.000119
92,136
pythondev
help
Actually, it looks like ```getattr``` will do that. Slightly less ugly.
2017-09-05T14:15:47.000476
Meghan
pythondev_help_Meghan_2017-09-05T14:15:47.000476
1,504,620,947.000476
92,137
pythondev
help
maybe something like:
2017-09-05T14:16:22.000208
Winnifred
pythondev_help_Winnifred_2017-09-05T14:16:22.000208
1,504,620,982.000208
92,138
pythondev
help
Yeah, that's what I found. It will work. Thanks.
2017-09-05T14:17:00.000074
Meghan
pythondev_help_Meghan_2017-09-05T14:17:00.000074
1,504,621,020.000074
92,139
pythondev
help
A lot cleaner than the mess I had above.
2017-09-05T14:17:11.000011
Meghan
pythondev_help_Meghan_2017-09-05T14:17:11.000011
1,504,621,031.000011
92,140
pythondev
help
No problem, you beat me to it!
2017-09-05T14:17:45.000059
Winnifred
pythondev_help_Winnifred_2017-09-05T14:17:45.000059
1,504,621,065.000059
92,141
pythondev
help
if you expect this behavior, you may be able to add methods to class that operate on state of instance
2017-09-05T14:19:34.000429
Winnifred
pythondev_help_Winnifred_2017-09-05T14:19:34.000429
1,504,621,174.000429
92,142
pythondev
help
I'm not sure what you mean.
2017-09-05T14:20:22.000252
Meghan
pythondev_help_Meghan_2017-09-05T14:20:22.000252
1,504,621,222.000252
92,143
pythondev
help
you’re operating on an instance of a class, why not write a method on instance to take in `self`?
2017-09-05T14:21:27.000341
Winnifred
pythondev_help_Winnifred_2017-09-05T14:21:27.000341
1,504,621,287.000341
92,144
pythondev
help
I'm still not sure what you mean. Example code?
2017-09-05T14:29:21.000623
Meghan
pythondev_help_Meghan_2017-09-05T14:29:21.000623
1,504,621,761.000623
92,145
pythondev
help
This is what im thinking, but I don’t actually know what your function is doing.
2017-09-05T14:43:40.000477
Winnifred
pythondev_help_Winnifred_2017-09-05T14:43:40.000477
1,504,622,620.000477
92,146
pythondev
help
Sorry, got distracted. I see what you are saying. I think the getattr fits what I'm doing better.
2017-09-05T14:58:18.000348
Meghan
pythondev_help_Meghan_2017-09-05T14:58:18.000348
1,504,623,498.000348
92,147
pythondev
help
I realize I didn't describe how I got there, so it makes it difficult. It is just a lot of code across different modules. But, it's from a modular gui in kivy that is listing a pretty version of a method name, the user selects what objects, and from there what methods to run, and kivy then sends on the list of strings. It's been interesting, for sure.
2017-09-05T14:59:53.000623
Meghan
pythondev_help_Meghan_2017-09-05T14:59:53.000623
1,504,623,593.000623
92,148
pythondev
help
ah yeah, I was making assumptions about what you were doing :neutral_face:
2017-09-05T15:33:17.000555
Winnifred
pythondev_help_Winnifred_2017-09-05T15:33:17.000555
1,504,625,597.000555
92,149
pythondev
help
that definitely does sound interesting!
2017-09-05T15:33:26.000243
Winnifred
pythondev_help_Winnifred_2017-09-05T15:33:26.000243
1,504,625,606.000243
92,150
pythondev
help
Hi guys! I just joined this channel. I am hoping that someone can maybe help me with a matplotlib chart I'm struggling with. ``` sns.set_palette('muted') fig, ax1 = plt.subplots(figsize=(12, 6)) fig.patch.set_facecolor('grey') ax1.plot(df['Time'], df[[col for col in df.columns if 'level' in col]]) ax1.set_xlabel('Time of day') ax1.set_ylabel('Dam level (%)') ax1.set_ylim([0, 100]) ax2 = ax1.twinx() ax2.plot(df['Time'], df[[col for col in df.columns if 'status' in col]]) ax2.set_ylabel('Pump status') ax2.yaxis.set_major_locator(MaxNLocator(integer=True)) #ax1.xaxis.set_major_locator(mdates.HourLocator()) #ax1.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M')) fig.autofmt_xdate() plt.xticks(rotation=90) '''hfmt = mdates.DateFormatter('%H:%M') ax1.xaxis.set_major_locator(mdates.HourLocator()) ax1.xaxis.set_major_formatter(hfmt)''' ax1.grid(which='major', alpha=0.5) ax2.grid(which='major', alpha=0.5) fig.tight_layout() plt.show() plt.close('all') ```
2017-09-05T16:01:42.000005
Jon
pythondev_help_Jon_2017-09-05T16:01:42.000005
1,504,627,302.000005
92,151
pythondev
help
It's plotting data with x data being time format.
2017-09-05T16:02:03.000224
Jon
pythondev_help_Jon_2017-09-05T16:02:03.000224
1,504,627,323.000224
92,152
pythondev
help
I actually want the x ticks to be rotated 90 degrees, but that's not happening for some reason I also want the x ticks to be each hour, but as soon as I uncomment the two #-commented lines, the xticks go away entirely Could someone please help?
2017-09-05T16:04:27.000414
Jon
pythondev_help_Jon_2017-09-05T16:04:27.000414
1,504,627,467.000414
92,153
pythondev
help
I've not used matplotlib, but others likely have. It takes a bit to get a response though, especially when other libraries are involved.
2017-09-05T16:08:23.000412
Meghan
pythondev_help_Meghan_2017-09-05T16:08:23.000412
1,504,627,703.000412
92,154
pythondev
help
I'm starting to dislike matplotlib more and more :neutral_face:
2017-09-05T16:09:15.000036
Jon
pythondev_help_Jon_2017-09-05T16:09:15.000036
1,504,627,755.000036
92,155
pythondev
help
<@Luana> can you clarify? those crud operations are based on http methods. but you still want to reference the domain in this case `/album/{some_params}` correct? maybe I’m missing something?
2017-09-05T19:09:12.000145
Eartha
pythondev_help_Eartha_2017-09-05T19:09:12.000145
1,504,638,552.000145
92,156
pythondev
help
Ok little doubt...
2017-09-05T22:17:37.000135
Lana
pythondev_help_Lana_2017-09-05T22:17:37.000135
1,504,649,857.000135
92,157
pythondev
help
Never mind, I was going to ask for floor division in Python 3, found the `foo //= bar` one
2017-09-05T22:20:34.000246
Lana
pythondev_help_Lana_2017-09-05T22:20:34.000246
1,504,650,034.000246
92,158
pythondev
help
*UPDATE*: It doesn't work, proper syntax is `foo // bar`
2017-09-05T22:37:14.000261
Lana
pythondev_help_Lana_2017-09-05T22:37:14.000261
1,504,651,034.000261
92,159
pythondev
help
<@Lana>, check out `divmod` too
2017-09-05T22:39:19.000130
Winnifred
pythondev_help_Winnifred_2017-09-05T22:39:19.000130
1,504,651,159.00013
92,160
pythondev
help
Thanks <@Winnifred> but I'm trying to do something different. A 3x2 deal within a function
2017-09-05T22:47:46.000016
Lana
pythondev_help_Lana_2017-09-05T22:47:46.000016
1,504,651,666.000016
92,161
pythondev
help
My code looks like this: `self.pOH -= (self.pOH // 3)`
2017-09-05T22:48:03.000273
Lana
pythondev_help_Lana_2017-09-05T22:48:03.000273
1,504,651,683.000273
92,162
pythondev
help
If `self.pOH = 5`, then `self.pOH -= (self.pOH // 3) = 4`
2017-09-05T22:49:00.000120
Lana
pythondev_help_Lana_2017-09-05T22:49:00.000120
1,504,651,740.00012
92,163
pythondev
help
Anyway, looked up the docs, you're right!
2017-09-05T22:49:27.000043
Lana
pythondev_help_Lana_2017-09-05T22:49:27.000043
1,504,651,767.000043
92,164
pythondev
help
:taco: <@Winnifred>
2017-09-05T22:49:33.000210
Lana
pythondev_help_Lana_2017-09-05T22:49:33.000210
1,504,651,773.00021
92,165
pythondev
help
ha, yeah, there’s lots of ways to do what you want
2017-09-05T22:49:51.000187
Winnifred
pythondev_help_Winnifred_2017-09-05T22:49:51.000187
1,504,651,791.000187
92,166
pythondev
help
Can someone help here with cryptography lib in python.. I am trying to decrypt the text which I get from node.js app. This is how I can decrypt the key in nodejs `key.decrypt(&lt;encrypted_text`, ‘base64’, ‘utf8’, ursa.RSA_PKCS1_PADDING)` However, when I try to decrypt same text using python `cryptography` module, I get error. Here is more detail: I am trying to decrypt that in python using this code : ```from Crypto.Cipher import PKCS1_v1_5 from Crypto.PublicKey import RSA from Crypto.Hash import SHA from Crypto.Hash import SHA from Crypto import Random from base64 import b64decode key = RSA.importKey(open('cert.key').read()) sentinel = Random.new().read(15+dsize) # Let's assume that average data length is 15 text = b64decode(&lt;encrypted_text&gt;) cipher = PKCS1_v1_5.new(key) message = cipher.decrypt(text, sentinel) print 'message =====&gt;', message` ``` I get this error: ``` --------------------------------------------------------------------------- ValueError Traceback (most recent call last) &lt;ipython-input-180-a1b00798e108&gt; in &lt;module&gt;() 19 20 cipher = PKCS1_v1_5.new(key) ---&gt; 21 message = cipher.decrypt(text, sentinel) 22 print 'message =====&gt;', message, '\n' 23 digest = SHA.new(message[:-dsize]).digest() /Users/skapil/.virtualenvs/dave/lib/python2.7/site-packages/Crypto/Cipher/PKCS1_v1_5.pyc in decrypt(self, ct, sentinel) 202 # Step 1 203 if len(ct) != k: --&gt; 204 raise ValueError("Ciphertext with incorrect length.") 205 # Step 2a (O2SIP), 2b (RSADP), and part of 2c (I2OSP) 206 m = self._key.decrypt(ct) ValueError: Ciphertext with incorrect length. ```
2017-09-05T23:01:24.000092
Daron
pythondev_help_Daron_2017-09-05T23:01:24.000092
1,504,652,484.000092
92,167
pythondev
help
I told about this url `album/create/` better to deal with it is send POST to `/album/` ``` POST /album/ %and here will be json of params like% { "artist_id":123, "album_id":456 } %or here will be post form params. It depends on your needs% ``` There is good article about rest api design. Link to urls explanation <http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#restful> But! It’s all about http rest api. If you wanna some kind of rpc, it’s a different story
2017-09-06T02:12:12.000126
Luana
pythondev_help_Luana_2017-09-06T02:12:12.000126
1,504,663,932.000126
92,168
pythondev
help
<@Daron> with an issue like this, look at how the incoming data is first created. how are you encrypting the original text? seems that is the issue here. what library is used in node?
2017-09-06T05:58:00.000030
Meg
pythondev_help_Meg_2017-09-06T05:58:00.000030
1,504,677,480.00003
92,169
pythondev
help
Hi Can someone please help me with this matplotlib fill_between? ``` x = range(0, 10) y = x fig, ax = plt.subplots(figsize=(12, 6)) ax.plot(x,y) fig.patch.set_facecolor('grey') ax.fill_between(x, 0, 10, where=x &gt; 5 and x &lt; 7, facecolor='red', alpha=0.5) ```
2017-09-06T08:37:55.000411
Jon
pythondev_help_Jon_2017-09-06T08:37:55.000411
1,504,687,075.000411
92,170
pythondev
help
<@Jon> can you give more info
2017-09-06T08:40:07.000351
Meg
pythondev_help_Meg_2017-09-06T08:40:07.000351
1,504,687,207.000351
92,171
pythondev
help
if you want help, we need to know what's wrong and what you're expecting
2017-09-06T08:40:33.000499
Meg
pythondev_help_Meg_2017-09-06T08:40:33.000499
1,504,687,233.000499
92,172
pythondev
help
<@Meg> it's giving an error on the last line I want to shade the entire chart area for certain x regions. In this case, between 5 and 7 (excl.)
2017-09-06T08:44:09.000436
Jon
pythondev_help_Jon_2017-09-06T08:44:09.000436
1,504,687,449.000436
92,173
pythondev
help
what error
2017-09-06T08:50:43.000386
Meg
pythondev_help_Meg_2017-09-06T08:50:43.000386
1,504,687,843.000386
92,174
pythondev
help
`TypeError: '&gt;' not supported between instances of 'range' and 'int'`
2017-09-06T08:51:57.000214
Jon
pythondev_help_Jon_2017-09-06T08:51:57.000214
1,504,687,917.000214
92,175
pythondev
help
Any idea <@Meg>?
2017-09-06T09:05:05.000175
Jon
pythondev_help_Jon_2017-09-06T09:05:05.000175
1,504,688,705.000175
92,176
pythondev
help
make sure what you are comparing are ints
2017-09-06T09:06:16.000304
Ciera
pythondev_help_Ciera_2017-09-06T09:06:16.000304
1,504,688,776.000304
92,177
pythondev
help
or the same type
2017-09-06T09:06:28.000389
Ciera
pythondev_help_Ciera_2017-09-06T09:06:28.000389
1,504,688,788.000389
92,178
pythondev
help
Well, x is a range of ints?
2017-09-06T09:06:34.000384
Jon
pythondev_help_Jon_2017-09-06T09:06:34.000384
1,504,688,794.000384
92,179
pythondev
help
Comparison must between the same type, or after implicit conversion
2017-09-06T09:24:31.000350
Corinna
pythondev_help_Corinna_2017-09-06T09:24:31.000350
1,504,689,871.00035
92,180
pythondev
help
To be honest, this was just an example that I tried My actual one has x values being of DateTime time
2017-09-06T09:25:28.000219
Jon
pythondev_help_Jon_2017-09-06T09:25:28.000219
1,504,689,928.000219
92,181
pythondev
help
*type
2017-09-06T09:25:33.000076
Jon
pythondev_help_Jon_2017-09-06T09:25:33.000076
1,504,689,933.000076
92,182
pythondev
help
Can someone please help?
2017-09-06T09:35:34.000052
Jon
pythondev_help_Jon_2017-09-06T09:35:34.000052
1,504,690,534.000052
92,183
pythondev
help
<@Jon> the issue is your original example is non-representative of your actual input. You didn't specify a crucial part of the problem at the start. And you've given no indication of actually using datetime objects for comparison
2017-09-06T09:41:31.000187
Meg
pythondev_help_Meg_2017-09-06T09:41:31.000187
1,504,690,891.000187
92,184
pythondev
help
Okay I'll re-post using that
2017-09-06T09:41:49.000364
Jon
pythondev_help_Jon_2017-09-06T09:41:49.000364
1,504,690,909.000364
92,185
pythondev
help
It's just much longer, which is why I tried to generalise it a bit
2017-09-06T09:42:15.000013
Jon
pythondev_help_Jon_2017-09-06T09:42:15.000013
1,504,690,935.000013
92,186
pythondev
help
``` sns.set_palette('muted') x = df['DateTime2'].values fig, ax1 = plt.subplots(figsize=(12, 6)) fig.patch.set_facecolor('grey') ax1.plot(x, df[[col for col in df.columns if 'level' in col]]) ax1.set_xlabel('Time of day') ax1.set_ylabel('Dam level (%)') ax1.set_ylim([0, 100]) ax2 = ax1.twinx() ax2.plot(x, df[[col for col in df.columns if 'status' in col]]) ax2.set_ylabel('Pump status') ax2.yaxis.set_major_locator(MaxNLocator(integer=True)) ax1.xaxis.set_major_locator(mdates.HourLocator()) ax1.xaxis.set_minor_locator(mdates.MinuteLocator(byminute=30)) ax1.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M')) fig.autofmt_xdate(rotation=90) ax1.set_xlim((min(x),max(x))) y = df[[col for col in df.columns if 'level' in col]] x2 = pd.to_numeric(x) ax1.fill_between(x2, 0, 100, where=x2 &gt; 990014340000000000/2, facecolor='red', alpha=0.5) ax1.grid(which='major', alpha=0.5) ax1.grid(which='minor', alpha=0.25) ax2.grid(which='major', alpha=0.5) #ax1.minorticks_on() fig.tight_layout() plt.show() fig.savefig('output.png') plt.close('all') ``` No shading is happening...
2017-09-06T09:42:56.000162
Jon
pythondev_help_Jon_2017-09-06T09:42:56.000162
1,504,690,976.000162
92,187
pythondev
help
`x2 = array([989971200000000000,` ..... `990057360000000000, 990057480000000000], dtype=int64)`
2017-09-06T09:43:44.000568
Jon
pythondev_help_Jon_2017-09-06T09:43:44.000568
1,504,691,024.000568
92,188
pythondev
help
that's your problem there
2017-09-06T09:45:40.000160
Meg
pythondev_help_Meg_2017-09-06T09:45:40.000160
1,504,691,140.00016
92,189
pythondev
help
because you need to compare on the actual values in `x2`
2017-09-06T09:45:50.000046
Meg
pythondev_help_Meg_2017-09-06T09:45:50.000046
1,504,691,150.000046
92,190
pythondev
help
try `where=numeric_timestamp in x2`
2017-09-06T09:46:47.000412
Meg
pythondev_help_Meg_2017-09-06T09:46:47.000412
1,504,691,207.000412
92,191
pythondev
help
So I should make a new list and check if the *numeric* timestamps are in there?
2017-09-06T09:47:36.000420
Jon
pythondev_help_Jon_2017-09-06T09:47:36.000420
1,504,691,256.00042
92,192
pythondev
help
no need. look at my example above
2017-09-06T09:48:12.000663
Meg
pythondev_help_Meg_2017-09-06T09:48:12.000663
1,504,691,292.000663
92,193
pythondev
help
ah, correction
2017-09-06T09:48:27.000080
Meg
pythondev_help_Meg_2017-09-06T09:48:27.000080
1,504,691,307.00008
92,194
pythondev
help
yes
2017-09-06T09:48:28.000088
Meg
pythondev_help_Meg_2017-09-06T09:48:28.000088
1,504,691,308.000088
92,195
pythondev
help
you can use a list comprehesion for that
2017-09-06T09:48:38.000016
Meg
pythondev_help_Meg_2017-09-06T09:48:38.000016
1,504,691,318.000016
92,196
pythondev
help
Something like this? `where=[x for x in x2 if x in list]`
2017-09-06T09:50:46.000663
Jon
pythondev_help_Jon_2017-09-06T09:50:46.000663
1,504,691,446.000663
92,197
pythondev
help
so, the `where` param uses a comparison to evaulate as true/false to determine where fill happens
2017-09-06T09:53:26.000104
Meg
pythondev_help_Meg_2017-09-06T09:53:26.000104
1,504,691,606.000104
92,198
pythondev
help
if you pass in a list of values, it needs something to compare with
2017-09-06T09:53:38.000242
Meg
pythondev_help_Meg_2017-09-06T09:53:38.000242
1,504,691,618.000242
92,199
pythondev
help
and the `in` keyword does an exact match
2017-09-06T09:53:50.000098
Meg
pythondev_help_Meg_2017-09-06T09:53:50.000098
1,504,691,630.000098
92,200
pythondev
help
<https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.fill_between.html>
2017-09-06T09:54:52.000348
Meg
pythondev_help_Meg_2017-09-06T09:54:52.000348
1,504,691,692.000348
92,201
pythondev
help
ah, correction.
2017-09-06T09:55:04.000540
Meg
pythondev_help_Meg_2017-09-06T09:55:04.000540
1,504,691,704.00054
92,202