-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: FutureWarning when splitting a dataframe using np.split
#57351
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
Comments
|
Thanks for the report - is there a reason you prefer to use |
@rhshadrach the use case here is not |
Ah, thanks @amanlai. On main,
On 2.2.x, I am seeing
|
Marking this as a blocker for 3.0 so a decision is made. |
I don't think many people use And as stated in numpy/numpy#24889 (comment) it's possible to calculate the start/stop slices and then manually slicing using |
I agree with @Aloqeely. Is there an upstream issue for NumPy on this topic? I think should be resolved there and use |
Ah ignore my previous comment - I thought they were calling our swapaxes implementation but misread the OP. Assuming they call swapaxes generically for their internal use, so not as easy as changing the call Even still I don't think we should revert this deprecation |
Is it sensible to implement a I can work on it next week if you are all ok with it. |
|
I don't think so - generally our goal is to reduce the footprint of our API, and I don't see this as a huge value add over the other method you have suggested:
|
+1 👍 splitting a dataframe into equally sized chunks (except for the trailing chunk) is a routine task in ML and other batching applications. requiring end-users to replace np.split/np.array_split with some bespoke |
another big reason to use np.array_split is the optional |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The above code raises a FutureWarning:
As far as I understand,
np.split
usesnp.swapaxes
which is raising this warning.Expected Behavior
Not show a warning.
Installed Versions
python : 3.11.5
pandas : 2.2.0
numpy : 1.26.3
The text was updated successfully, but these errors were encountered: