Skip to content

BUG: interpolate gives a TypeError on empty dataframes #35598

Closed
@sanderland

Description

@sanderland

Already fixed in #35543, making an issue for linking/discussion.

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

from pandas import DataFrame
DataFrame().interpolate()
"Cannot interpolate with all object-dtype columns "

TypeError: Cannot interpolate with all object-dtype columns in the DataFrame. Try setting at least one column to a numeric dtype.

Problem description

This is a regression, 1.0.5 handles it fine.

The problem appeared due to checking np.all(obj.dtypes == np.dtype(object)) since the all of an empty set is True

Expected Output

Output of pd.show_versions()

pandas : 1.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffBugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions