-
Notifications
You must be signed in to change notification settings - Fork 43
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
DataFrame reduction methods broken #174
Comments
Can this be closed now? Or we could leave this open until df.min(), df.max() etc are tested. |
No, this is still broken under pandas~=1.5, as well as pandas~=2.0. I don't think anything short of a change in the |
What versions was this last working with? I am unsure if it was a pandas change or a pint change that has caused this. In Block.reduce, pandas 1.4.x there's a try, except clause https://github.com/pandas-dev/pandas/blob/1.4.x/pandas/core/internals/blocks.py#L413 |
Note that it is failing outside the try-except block. |
I tried several versions which didn't work.
I note that running |
Looks like pandas is working on this already and should be in the next version! |
On it...this has one extraneous change (preserve dtype when converting NA to array of Quantities), but I offer these as essentially the minimal changes needed to work with upcoming Pandas 2.1. (This work work any Pandas < 2.1) I will be bundling this with a PR that's already slated to land in Pint 0.23 (and other PRs in Pandas, Pint-Pandas, and uncertainties). But if you want to apply and test by itself...
|
Issue hgrecco#174 reports that DataFrame reduction was broken by the latest Pint-Pandas changes. This commit adapts Pint-Pandas to work with upcoming Pandas 2.1, currently scheduled for release Aug 20, 2023. Signed-off-by: Michael Tiemann <[email protected]>
Just a small note that pandas-dev/pandas#52788 has been merged in pandas. I think that should help fix this issue in pint-pandas? |
I agree this should be possible in v2.1 (not released yet), but pint_pandas still needs to implement a I could take a stab at a PR for this if I can get someone to review the PR. I assume the tests should be added to |
Hey, that was me 😄 PR#140 has the keepdims changes. You could split them out and merge them independently. The TestReductions (note 's' at the end) does need to be incorporated. It looks like the Pandas base test case makes up its own data, and that such data is not as trivial as |
yea go for it. I was holding out for a rc (which doesn't look like is happening) before taking a look as it takes ages for the CI to build pandas otherwise. |
I've split out the changes here: #196 |
Pandas 2.1.0rc0 is now available. Could be a good time to sync up with our own release candidates. |
195: fix pandas v2.1 NumpyEADtype issue r=andrewgsavage a=topper-123 - [x] Closes #194 - [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 - [ ] Added an entry to the CHANGES file Precursor to working on #174. Co-authored-by: Terji Petersen <[email protected]>
close by #195 pd.DataFrame([[0, 1, 2], [3, 4, 5]]).astype("pint[m]").sum()
0 3.0
1 5.0
2 7.0
dtype: pint[meter] |
Amazing, thanks @topper-123 ! |
With the versions:
I am unable to run any dataframe-wise aggregation functions along
axis=0
:Similarly
df.min()
,df.max()
and so on are failing.This might be connected with:
hgrecco/pint#1128 (comment)
The text was updated successfully, but these errors were encountered: