Skip to content

Document DataFrame._constructor_sliced-like property in the public API? #27824

Open
@TomAugspurger

Description

@TomAugspurger

Can we document something like DataFrame._constructor_sliced as the public way to say that slicing a column from a pandas.DataFrame will return a pandas.Series object?

Projects like Dask would like to work with any concrete DataFrame library (cudf being the second major dataframe implementation). Right now we resort to things like type(dask.dataframe.DataFrame._meta.iloc[:, 0]) to get the concrete type of a slice. But that's fragile (e.g. a DataFrame with no columns).

I'm not sure how useful this would be to users, so using an underscore-prefixed name may be reasonable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions