Skip to content
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

sqrt doesn't work on PintArrays #85

Closed
burnpanck opened this issue Jul 16, 2021 · 4 comments
Closed

sqrt doesn't work on PintArrays #85

burnpanck opened this issue Jul 16, 2021 · 4 comments

Comments

@burnpanck
Copy link
Contributor

The following code fails in the last line:

import numpy as np
import pandas as pa
import pint_pandas

x = pint_pandas.PintArray(np.arange(4),"m")
print(np.sqrt(x.quantity))
print(np.sqrt(x))
@burnpanck
Copy link
Contributor Author

This is probably a duplicate of #65.

@andrewgsavage
Copy link
Collaborator

sqrt isn't affected by __array_ufunc__ https://numpy.org/doc/1.14/neps/ufunc-overrides.html#list-of-operators-and-numpy-ufuncs

I think implementing __array_function__ would fix sqrt and many other np functions. It'd affect PintArray but not Series

@burnpanck
Copy link
Contributor Author

Thanks for the clarification! I didn't pay attention to the distinction of the two. So maybe I should edit this issue to make it ask for __array_function__?

@andrewgsavage
Copy link
Collaborator

well the code in OP works now, as of #160

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

No branches or pull requests

2 participants