Skip to content

Plotting ExtensionArrays #27118

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

Conversation

andrewgsavage
Copy link

How do I go about adding tests for that rely on an external module?
Would be something like

df = pd.DataFrame({
        "length" : pd.Series([1,2],dtype = pd.Int16Dtype),
        "width" : PA_([2,3], dtype="pint[m]"),
        "distance" : PA_([2,3], dtype="in"),
        "height" : PA_([2,3], dtype=ureg.m),
        "depth" : PA_.from_1darray_quantity(Q_([2,3],ureg.mm)),
    })
df.plot()

@pep8speaks
Copy link

pep8speaks commented Jun 29, 2019

Hello @andrewgsavage! 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 2019-06-30 07:12:34 UTC

# in select_dtypes
numeric_dtypes = [dtype for dtype in set(data.dtypes)
if hasattr(dtype, "_is_numeric") and
dtype._is_numeric and
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than this i would fix select_dtypes to understand the is_numeric flag of the EA dtype; it’s possible that actually need something more because for example datetimes are not numeric but are allowed for plotting

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed that this should be addressed in select_dtypes rather than here.

@andrewgsavage
Copy link
Author

I'm a bit confused here, df.select_dtypes('number') will not return columns with bool dtype. However is_numeric_dtype(dtype) will return True for bool. Should is_numeric_dtype be used in select_dtypes?

return frozenset(dtypes.union(extension_dtypes))
else:
return dtypes
include = add_extension_types(include, np.number, is_numeric_dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand this. Are you unconditionally adding adding an EA if it's considered numeric here?

@jreback
Copy link
Contributor

jreback commented Sep 8, 2019

can you merge master

@WillAyd
Copy link
Member

WillAyd commented Sep 20, 2019

Nice idea but looks like this has gone stale and I think has a few dependencies that need to be cleaned up. In any case @andrewgsavage if interested in continuing please ping and can reopen

@WillAyd WillAyd closed this Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plotting ExtensionArrays
5 participants