Skip to content

BUG: FutureWarning when splitting a dataframe using np.split #57351

Open
@amanlai

Description

@amanlai

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

To reproduce it:

import numpy as np
import pandas as pd

df = pd.DataFrame({'a': [1, 2, 3]})
lst = np.split(df, 3)

Issue Description

The above code raises a FutureWarning:

FutureWarning: 'DataFrame.swapaxes' is deprecated and will be removed in a future version. Please use 'DataFrame.transpose' instead.

As far as I understand, np.split uses np.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BlockerBlocking issue or pull request for an upcoming releaseCompatpandas objects compatability with Numpy or Python functionsDeprecateFunctionality to remove in pandasRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions