hgrecco / pint-pandas

Pandas support for pint
Other
166 stars 40 forks source link

pint_pandas won't import using pandas 2.1-dev version #194

Closed topper-123 closed 11 months ago

topper-123 commented 11 months ago

I just tried pint_pandas using the dev version of pandas and got an error:

>>> import pint_pandas
AttributeError: module 'pandas.core.dtypes.dtypes' has no attribute 'PandasDtype'

The issue is that pandas has renamed PandasDtype to NumpyEADtype, see https://github.com/pandas-dev/pandas/pull/54101.

MichaelTiemannOSC commented 11 months ago

Pandas 2.1rc0 has been released: https://github.com/pandas-dev/pandas/releases/tag/v2.1.0rc0

andrewgsavage commented 11 months ago

There is still some failures in the test suite when running against v2.1.dev, but fixing those will take some care to ensure the test suite will run in both v2.1 and in older pandas versions, so I'll take those in a separate PR.

Originally posted by @topper-123 in https://github.com/hgrecco/pint-pandas/issues/195#issuecomment-1660401978

Looking through #196, there's quite a few tests where there will be different behaviour in v2.1. Would it be easier to release the current pint-pandas for pandas 2.0, then change the mimimum pandas requirement to 2.1 for the future?

ping @MichaelTiemannOSC @hgrecco

MichaelTiemannOSC commented 11 months ago

Good question. #196 is named pandas21_compat, but it derives from changes that work equally well with Pandas 2.0.3 and Pandas 2.1. Indeed, I've been continually developing and testing the uncertainties PR (#140) against both. That latter experience makes me more confident that there's less incompatibility between 2.0.x and 2.1 than meets the eye.

That said, my efforts with the pandas21_compat changes have been to absolutely minimize divergence from the Pandas 2.1 codebase (and to use that minimality to convince Pandas developers to accept a few PRs to improve Pandas itself). While pandas21_compat may yet need some other changes lifted from the uncertainties changes to preserve common operation with Pandas 2.0.3, it really depends on the code of this PR which I have been loathe to copy into my own PRs because I'd prefer to pull it as a merged change. Once we have that, we can see what it looks like to support both. I don't think it will be that hard. Though I also think that anybody using Pint-Pandas will have a strong incentive to move up to Pandas 2.1 because it really has a lot of EA improvements that will make Pint-Pandas sing.