Skip to content

BUG: describe(include=..) fails with unrelated error if provided data types are not present #61863

Open
@jorisvandenbossche

Description

@jorisvandenbossche

Example with current main:

>>> df = pd.DataFrame({"a": [1, 2, 3]})
>>> df.describe(include=["datetime"])
...
ValueError: No objects to concatenate

I assume the error comes from under the hood trying to concatenate the results of calculating the describe results for each of the incluced dtype groups, and in this case for datetime there is no content, so nothing to concatenate.

But we shouldn't propagate that error message to the user, I think. Either we should provide a better error message about none of the included dtypes being present, or just return an empty DataFrame.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions