-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
BUG: Fixes plotting with nullable integers (#32073) #34896
Conversation
@MarcoGorelli I'm not sure where to put the whatsnew entry. |
Thanks for your PR! I think this should go under the plotting section of the bug fixes |
I've added the
Also any feedback on the docstring and typehints would be appreciated. Because of the many types that could be the input I wasn't sure what types to add there so I only added a hint for output type. |
Ah I don't pass my own test it seems, was sure I reran it after the last change. 🤦 The problem here is that for a Series object it'd need to call Perhaps we can simplify it by making |
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, just making a few comments (still need to address some of your questions though, but will get round to it)
Mypy gives the following error:
I could fix this by defering this to another function that only takes care of the |
The version of
How I see it there are 2 options:
Regarding the dates quantile; in both this version and master quantile of EDIT: the quantile issue seems too close to #33168 and #29485 to open a new issue for it. |
"A": [1, 2, 3, 4, 5], | ||
"B": [7, 5, np.nan, 3, 2], | ||
"C": pd.to_datetime(dates, format="%Y"), | ||
"D": pd.to_datetime(dates, format="%Y", utc=True), |
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.
@MarcoGorelli This is the test case that hits the elif is_datetime64tz_dtype(values.dtype)
branch in safe_convert_to_ndarray
.
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.
@cvanweelden thanks for pointing me towards this.
Are you sure? I just tried running it and didn't hit it. Perhaps it was true before you changed
safe_convert_to_ndarray(numeric_data[col])
to
safe_convert_to_ndarray(numeric_data[col].values)
?
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.
Ah yeah, you are right. I wasn't aware that the underlying values
were actually an ndarray with non-extended dtype, so I didn't know this change would have that effect. Thanks!
Given that the requested direction to have the same code path shared between the plotting function and |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Similar to #32410 this tries to fix plotting with nullable integer extension data types by casting them to float before passing on to matplotlib.