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

Complex magnitudes and other non floats #146

Closed
redhog opened this issue Oct 25, 2022 · 9 comments · Fixed by #148
Closed

Complex magnitudes and other non floats #146

redhog opened this issue Oct 25, 2022 · 9 comments · Fixed by #148

Comments

@redhog
Copy link

redhog commented Oct 25, 2022

PintArray does not currently support magnitudes of any other type than float. This includes complex numbers, so storing e.g. complex frequencies or I/Q values is not possible. Other compound types have the same problem: I started experimenting with storing coordinates with associated CRS (epsg codes) as pint values which works fine (including reprojection in context converters), but they can't go in a PintArray either :(

@MichaelTiemannOSC
Copy link
Collaborator

Xref #139

@redhog
Copy link
Author

redhog commented Oct 26, 2022

Ah thanks, that's very similar.

MichaelTiemannOSC@b5954fd#diff-3181ac97c806b62303f85f408bb9a556bdf5f61171d45ccc87df59a3c3adf6a5R228

would have to change. Why is the casting there at all? Can't self._data be a numpy array with dtype O if need be?

@redhog
Copy link
Author

redhog commented Oct 26, 2022

@redhog
Copy link
Author

redhog commented Oct 26, 2022

I'm not super familiar with the pint pandas code, but could give making a PR a try if you want, unless you can just whip that up super easily?

@redhog
Copy link
Author

redhog commented Oct 26, 2022

@MichaelTiemannOSC
Copy link
Collaborator

@redhog I couldn't follow your comments into the diff, but I'm happy to make whatever changes. I've very new to the pint communities and have no pride of authorship (yet).

@andrewgsavage
Copy link
Collaborator

Ideally, for a solution that works for all types, we'd want

PRs that help tackle these issues are welcomed!

@MichaelTiemannOSC
Copy link
Collaborator

I second Andrew's encouragement to (1) solve the NA problems, so we are not stuck resorting to float NaNs to represent NA data, and (2) to avoid object dtype, not only because of speed/memory efficiency, but once something becomes and object_dtype, it loses all the wonderful properties of Extension Arrays.

@redhog redhog mentioned this issue Oct 27, 2022
5 tasks
@redhog
Copy link
Author

redhog commented Oct 27, 2022

Made a PR that solves this that I think works, but it might break some assumptions I'm not aware of...

@bors bors bot closed this as completed in b02d486 Nov 23, 2022
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 a pull request may close this issue.

3 participants