Skip to content

Add a new DataFrame.dti accessor #27581

Closed
@ghost

Description

There's the dt accessor on Series which operates on the Series values:

pd.Series([1,2,3]).dt.day 
#exists. But checks that series *values*  datetime64[ns]

pd.Series([1,2,3]).day
# doesn't exist

There's a top-level method df.first:

Convenience method for subsetting initial periods of time series data
based on a date offset.

which looks like it should live behind dti accessor on DataFrame.

pd.DataFrame().first(0) 
# method is applicable only for datetime, but is in the top DataFrame namespace

There's currently no datetime accessor on dataframe. Would it make sense to move it below a dti accessor on DataFrame?

There's also an unfortunate unfortunate name collision betweenGroupby().first

Compute first of group values.

and DataFrame.first:

Convenience method for subsetting initial periods of time series data
based on a date offset.

Adding a dti accessor to DataFrame would clean that up as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions