Skip to content

DEPR: Timedelta with passed unit M, Y #16344

Closed
@jorisvandenbossche

Description

@jorisvandenbossche
In [7]: pd.Timedelta(1, unit='Y')
Out[7]: Timedelta('365 days 05:49:12')

In [8]: pd.Timedelta(1, unit='M')
Out[8]: Timedelta('30 days 10:29:06')

The above does not make much sense, so lets deprecate this (similar for to_timedelta).

For the case where those unit abbreviations are used in a string, Y already raises, while M is actually interpreted as minutes:

ValueError: invalid abbreviation: Y

In [13]: pd.to_timedelta('1M')
Out[13]: Timedelta('0 days 00:01:00')

xref #16335, #12691 and #14024

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeprecateFunctionality to remove in pandasTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions