Skip to content

DEPR: DatetimeIndex/TimedeltaIndex constructor keywords #55499

Open
@jbrockmendel

Description

@jbrockmendel

DatetimeIndex.__new__ has constructor keywords (excluding ones present in the base class and ones already deprecated) freq, tz, ambiguous, dayfirst, yearfirst. dayfirst and yearfirst overlap with the pd.to_datetime keywords.

Could we deprecate some/all of these keywords and point users to pd.to_datetime instead?

  • freq we could either exempt or make a post-construction thing by making _with_freq public.
  • to_datetime has utc instead of tz. I generally like tz better than utc as a keyword, but deprecating utc might be painful. We could add tz to to_datetime and disallow passing tz-and-utc.
  • Adding ambiguous to to_datetime wouldn't be too bad aside from general keyword fatigue.

(similarly TimedeltaIndex has unit and freq, unit being present in pd.to_timedelta)

cc @MarcoGorelli @mroeschke @jorisvandenbossche

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignDatetimeDatetime data dtypeDeprecateFunctionality to remove in pandasIndexRelated to the Index class or subclasses

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions