Skip to content

Change in behavior of DatetimeIndex + Offset #22465

Closed
@TomAugspurger

Description

@TomAugspurger
import pandas as pd

offset = pd.tseries.offsets.Week(weekday=6)
idx = pd.DatetimeIndex(['1999-12-26', '2000-05-14']) 

assert (idx[0] + offset) == (idx + offset)[0]

bisected to #18952

Before that the assertion was true, after it's false

# before
>>> idx + offset
DatetimeIndex(['2000-01-02', '2000-05-21'], dtype='datetime64[ns]', freq=None)

# after
>>> idx + offset
DatetimeIndex(['1999-12-26', '2000-05-14'], dtype='datetime64[ns]', freq=None)

cc @reidy-p is this an expected change due to #18952, or a new bug? If it's intentional, we should document that.

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