-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Index without 0 in xerr/yerr causes KeyError #11858
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@diazona This also seems a regression (in pandas or matplotlib), as I don't get an error with pandas 0.16.2 and matplotlib 1.4.3, but do get one with 0.17.1 and 1.5.0 |
Haven't looked, but sounds similar to matplotlib/matplotlib#5550 @diazona I'm assuming you're using matplotlib 1.5? Can you try with 1.4.3? |
Yeah, matplotlib/matplotlib#5550 seems like the exact same issue. That didn't come up in my search, so I hadn't realized the matplotlib developers were open to fixing it. If they do implement that fix, it renders my patch obsolete (though I think it's still a semantic improvement). Let me take some time to get a previous version of matplotlib and test with that. I am indeed using 1.5.0. Here's the complete version info:
|
Update: matplotlib 1.4.3 indeed does not exhibit the error. After an enthralling For what it's worth, the current master HEAD matplotlib/matplotlib@9f6bb90 does raise the I haven't tested with other versions of Pandas. |
Can someone re-check if this is still a problem? I think we fixed this is v1.5.1. |
yes, here v. 1.5.1 and the same problem |
In errorbar do not assume that [0] or [1] will work correctly (due to issues with pandas). Closes pandas-dev/pandas#11858
In errorbar do not assume that [0] or [1] will work correctly (due to issues with pandas). Closes pandas-dev/pandas#11858
When creating an errorbar plot, if the data object being used for the errors (
xerr
oryerr
) doesn't have 0 in its index, it produces aKeyError
from matplotlib code. I can produce this with the following code sample:The underlying bug (if it is a bug) in matplotlib is responsible for several other issues, including #4493 and #6127, but this case is different because it uses only Pandas API methods, rather than passing a Pandas object to a matplotlib method. So it's a little harder to justify passing this off on matplotlib to fix, as was done in e.g. #6127.
If the "proper" fix ever is implemented in matplotlib code, it should solve this as well as #4493 and #6127 and all the others of that nature, but until that point, Pandas can work around it by converting the error object (if it is a
Series
orDataFrame
) to anndarray
. I'm working on this in 4b04f80 but I'm not sure if there's a better way to fix it, or if this breaks something. (If so, the tests don't indicate it.)The text was updated successfully, but these errors were encountered: