Skip to content

DEPR: Period, PeriodFoo #54235

Open
Open
@jbrockmendel

Description

@jbrockmendel

This was discussed a few dev calls ago, merits an issue.

Now that we support non-nano TImestamp/datetime64, many of the motivating use cases for Period can be handled there. If we further extended this support to the other np.datetime64 units, could we obviate the need for Period altogether?

Upsides (after deprecations are enforced)

Some sticking points come to mind

  • Period units that don't have corresponding np.datetime64 units
    • BDay (xref DEPR: Period[B] #53446 that seems DatetimeIndex[D] with freq="B" should be good enough?)
    • Week-with-anchor
    • Quarter
    • Year-with-anchor
  • Period is stricter than Timestamp/dt64 about not allowing operations between periods with mismatched freqs/units
  • Would we want to support tz-awareness for lower-reso units? Timezones can have minute (maybe even higher in principle?) resolution, which would be very weird to pin to e.g. a dt64[h]. On the flip side, supporting tz for some units but not others might be akward.
  • Period supports integer multiples e.g. freq="2ms" which we don't currently support for dt64 (though numpy does, so it is possible)
  • PeriodIndex has slightly different partial-indexing behavior in get_loc than DatetimeIndex. Someone might be relying on that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeprecateFunctionality to remove in pandasNeeds DiscussionRequires discussion from core team before further actionPeriodPeriod data type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions