Skip to content

REF: move __array_ufunc__ to base NumericArray #38412

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

Merged

Conversation

jorisvandenbossche
Copy link
Member

xref #38110

The implementations for integer and float array is almost identical, so move to base class. In addition, this also enables that ufuncs on IntegerArray can return FloatingArray (instead of float numpy array)

I should probably consolidate the tests as well, and move those to tests/arrays/masked/test_ufunc.py or so.

In addition, BooleanArray.__array_ufunc__ is actually also very similar, but didn't include that here, yet. I should probably do that, but wondering if I should move the common __array_ufunc__ implementation to BaseMaskedArray, or rather make BooleanArray subclass NumericArray.

@jorisvandenbossche jorisvandenbossche added Refactor Internal refactoring of code NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Dec 11, 2020
@jorisvandenbossche jorisvandenbossche added this to the 1.3 milestone Dec 11, 2020
@jbrockmendel
Copy link
Member

mypy complaint, otherwise nice code sharing!

@jbrockmendel
Copy link
Member

@jorisvandenbossche can you merge master

@jreback
Copy link
Contributor

jreback commented Jan 1, 2021

can you merge master

@jorisvandenbossche
Copy link
Member Author

Updated, and mypy is happy now

@jreback jreback merged commit 9159513 into pandas-dev:master Jan 13, 2021
@jreback
Copy link
Contributor

jreback commented Jan 13, 2021

thanks @jorisvandenbossche

@jorisvandenbossche jorisvandenbossche deleted the EA-masked-numeric-ufuncs branch January 13, 2021 13:59
luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
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 Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants