Skip to content

BUG: Unary pos/neg ops on IntegerArrays failing with TypeError #36078

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 6 commits into from

Conversation

asishm
Copy link
Contributor

@asishm asishm commented Sep 2, 2020

@asishm asishm marked this pull request as draft September 2, 2020 22:22
@TomAugspurger
Copy link
Contributor

What behavior do we want for unary minus on a uint array? Wrap around?

@asishm
Copy link
Contributor Author

asishm commented Sep 2, 2020

0 - uint_series currently wraps arround. probably makes sense to keep the unary neg to exhibit the same behavior.

Also I'm not sure if I wrote the tests correctly. I think I'd have to xfail test_neg and test_pos for BooleanArrays or move those methods over to test_integer.py specifically. thoughts?

@asishm
Copy link
Contributor Author

asishm commented Sep 2, 2020

there's a simpler fix here

by adding __neg__ and __pos__ implementations to BaseMaskedArray (__invert__ is already implemented) and changing the __neg__ implementation of BooleanArray to call __invert__

That passes the current tests that I added.

thoughts?
#36081 for implementation

@jreback jreback added Bug ExtensionArray Extending pandas with custom dtypes or arrays. labels Sep 5, 2020
@asishm asishm closed this Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Unary minus raises for series with Int64Dtype
3 participants