Skip to content

BUG: Unexpected period range index shift #44363

Open
@jmcinto

Description

@jmcinto

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the master branch of pandas.

Reproducible Example

import pandas as pd
from datetime import datetime
print(pd.__version__)
df = pd.DataFrame(range(24))
df.index = pd.period_range(datetime(1900,1,1), periods=24, freq="1H")
resamp = df.resample("6H",label='right', closed='right').sum()

Issue Description

Resampling a df that has a period range index results in an unexpected temporal shift in the results in the pandas version 1.3.4. This can be seen by running the example code in version 1.3.4 and comparing the results to version 1.0.5.

Expected Behavior

Running the example code in version 1.0.5 results in the expected behavior.

Installed Versions

1.3.4

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