Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
FIX: pandas indexing error#5556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
lib/matplotlib/dates.py Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
line1565 should be modified to
except (TypeError,StopIteration):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for catching that!
50b547c to825f613Comparetacaswell commentedDec 21, 2015
rebased. |
tacaswell commentedDec 22, 2015
Also addresses#5557 |
lib/matplotlib/axes/_axes.py Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
"is" --> "in"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I swear I know english...
WeatherGod commentedDec 28, 2015
besides the nitpicking, this looks good to me |
tacaswell commentedDec 28, 2015
@WeatherGod do you want me to drop that (some what superfluous) white space commit? |
WeatherGod commentedDec 28, 2015
Eh, might be better to get rid of that commented out code entirely. I don't see the point of keeping it around. |
tacaswell commentedDec 28, 2015
Well, the minimum numpy is now 1.6 so we should do what ever it was that note was telling us to do. |
WeatherGod commentedDec 28, 2015
? |
tacaswell commentedDec 28, 2015
The comment below the commented line says that we are handling |
WeatherGod commentedDec 28, 2015
Ah, yeah, that comment (I must be getting blind...). I suspect that it is quite old and came from before the days that stacked histograms and such were possible. I am not sure it is possible to just hand off the responsibility of norming to numpy any more given the current feature set. |
6ec1bbd tof0a8a02Comparepd.Series prefer indexing via searching the index to positionalindexing. This method will get the first element of any iterable.It will advance a generater, but they did not work previously anyway.Closesmatplotlib#5550
using `next(iter(obj))` can raise `TypeError` if obj is not iterableand `StopIteration` if len(obj) == 0. As we are no longer explictilyindexing into `obj` it should not raise an `IndexError`
Both iterable and index_of are imported at the top of this import block
f0a8a02 tobb7691bComparetacaswell commentedDec 29, 2015
This is passing and not conflicting, can someone push the button on this before it needs another rebase 😈 . |
WeatherGod commentedDec 29, 2015
I do have another concern with respect to generators. Previously, generators just simply didn't work, now they may sort of work (generator gets partly consumed). This muddles the API a bit. Wouldn't it be better to detect that we have a generator and raise an error? We can later consider how to properly support generators without consuming them. |
tacaswell commentedDec 29, 2015
That is a can of worms of handling I am worried about opening and would rather punt on the whole thing. This at least does notbreak any existing user code. |
WeatherGod commentedDec 29, 2015
isn't it just simply a matter of testing |
tacaswell commentedDec 29, 2015
I am more worried about applying that test uniformly across the library. |
WeatherGod commentedDec 29, 2015
That would be nice, but it is not the goal that I am seeking. Simply that we add this test where-ever we have code that would potentially consume an iterator. That way, the API hasn't changed. So, that is just two places here in this PR. |
tacaswell commentedDec 29, 2015
fair enough |
All versions of python we support have built in `next`
- moved next(iter(obj)) logic into a cbook function
tacaswell commentedDec 29, 2015
Digging into this a bit (and trying to sort out why This PR is a whack-a-mole fix which will get 1.5.1 out the door. |
tacaswell commentedDec 29, 2015
The test failure is un-related (due to backport of custom RNG). |
WeatherGod commentedDec 29, 2015
seems like it, was the baseline images not updated for the new RNG? |
mdboom commentedDec 29, 2015
They were. This looks like a "only on Travis" sort of failure. |
WeatherGod commentedDec 29, 2015
That doesn't give me any sort of warm fuzzies... |
tacaswell commentedDec 29, 2015
I can reproduce it locally (but it passedbefore I pushed upstream (which I assume means my local install had become screwed up)). |
WeatherGod commentedDec 29, 2015
I hope this hasn't become another rabbit-infested dragon cave... |
WeatherGod commentedDec 30, 2015
Looks like you cleared out the rabbits! |
WeatherGod commentedDec 30, 2015
By moving a bit of the if-statement into a cbook function, the if-statement starts to be a little bit clearer. Probably would be a good idea to have some cbook tests at some point, but that can come later. |
Specifically, when creating collection objects,`linewidths` and `antialiaseds` can be non zero indexedpandas series.Related to: PR#5556
This was unintentionally broken bybdaaf59 which went in as part ofPRmatplotlib#5556 which was fixing support for pandas series.
This was unintentionally broken bybdaaf59 which went in as part ofPRmatplotlib#5556 which was fixing support for pandas series.
pd.Series prefer indexing via searching the index to positional
indexing. This method will get the first element of any iterable.
It will advance a generater, but they did not work previously anyway.
Closes#5550