Skip to content

BUG: fixes plotting with nullable integers (#32073) #32410

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

Closed
wants to merge 8 commits into from
Closed

BUG: fixes plotting with nullable integers (#32073) #32410

wants to merge 8 commits into from

Conversation

jeandersonbc
Copy link
Contributor

@jeandersonbc jeandersonbc commented Mar 3, 2020

@pep8speaks
Copy link

pep8speaks commented Mar 3, 2020

Hello @jeandersonbc! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-03-03 18:33:32 UTC

@jeandersonbc
Copy link
Contributor Author

Is this still useful?

Comment on lines +421 to +422
if len(data) > 0:
return np.asarray(data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this check?

{
"A": [1, 2, 3, 4, 5],
"B": [7, 5, np.nan, 3, 2],
"C": pd.to_datetime(dates, format="%Y"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a datetime with timezone column? That will have an extension dtype.

if len(data) > 0:
return np.asarray(data)

return data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we always converted to ndarray. Why aren't we doing that anymore?


self.data = numeric_data
# GH25587: cast ExtensionArray of pandas (IntegerArray, etc.) to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not just np.asarray(data) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will result in object dtype with NAs, which matplotlib doesn't understand.

@jbrockmendel jbrockmendel added NA - MaskedArrays Related to pd.NA and nullable extension arrays Visualization plotting labels Mar 19, 2020
@jreback
Copy link
Contributor

jreback commented Apr 6, 2020

@jeandersonbc can you update and address comments.

@simonjayhawkins
Copy link
Member

@jeandersonbc closing as stale. ping if you want to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NA - MaskedArrays Related to pd.NA and nullable extension arrays Visualization plotting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plotting Int64 columns with nulled integers (NAType) fails
6 participants