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

pint-pandas having problems with the new pint release #168

Closed
andresliszt opened this issue May 2, 2023 · 4 comments · Fixed by #171
Closed

pint-pandas having problems with the new pint release #168

andresliszt opened this issue May 2, 2023 · 4 comments · Fixed by #171

Comments

@andresliszt
Copy link

pint released a new version 0.21 and pint-pandas is having problems when you try to import it AttributeError: module 'pint.compat' has no attribute 'upcast_types'

@MichaelTiemannOSC
Copy link
Collaborator

If you delete the last line of the file pint_array.py (which calls compat.upcast_types) it might just work. It does for me.

@karelplanken
Copy link

I stumbled across this message after I figured out that commenting the last line in pint_array.py (line 995) indeed works.

@sbowman-mitre
Copy link

sbowman-mitre commented May 5, 2023

This solution is a good work-around when doing local development, but in a CI pipeline where these dependencies are being installed and then immediately used (no human involved), this is not a useful work-around. Any other ideas? Like, if I lock down to a specific version of pint, which one should I use?

EDIT: looks like using this in a requirements.txt suffices to get my automation running again: pint<0.21

@mikapfl
Copy link
Contributor

mikapfl commented May 5, 2023

Seems to be related to this commit in pint: hgrecco/pint@77ff32a where the structure of pint's pandas integration was changed, and appending to upcast_types is not necessary any more to get pint-pandas working properly. So probably pint-pandas needs to support both the old way of integration and the new way?

bors bot added a commit that referenced this issue May 10, 2023
171: Fix importing with Pint 0.21 r=andrewgsavage a=mikapfl

Hi,

this fixes importing with Pint 0.21 as discussed in #168.

- [x] Closes #168
- [x] Executed ``pre-commit run --all-files`` with no errors
- [ ] The change is fully covered by automated unit tests
- [ ] Documented in docs/ as appropriate
- [x] Added an entry to the CHANGES file

Not all unit tests pass because Pint 0.21 changed other things, but at least the unit tests can be executed.

Cheers,

Mika

Co-authored-by: Mika Pflüger <mika.pflueger@climate-resource.com>
bors bot added a commit that referenced this issue May 14, 2023
179: Fix up pint 0.21 and re-enable tests r=andrewgsavage a=coroa

Adds the full name of DataFrame to `upcast_type_map` (as a backport of hgrecco/pint#1777) and re-enables most tests marked xfail in #168, except for the groupby with extension arrays one, which still fails with pandas>=2.0, until one of #172, #176 or #178 is in.

- [ ] ~Closes # (insert issue number)~ Issues are already closed
- [x] Executed ``pre-commit run --all-files`` with no errors
- [x] The change is fully covered by automated unit tests
- [ ] ~Documented in docs/ as appropriate~
- [x] Added an entry to the CHANGES file


Co-authored-by: Jonas Hoersch <jonas.hoersch@climateanalytics.org>
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.

5 participants