Skip to content

BUG: Unable to resample period range with dates above 2262-04-11  #44326

Closed
@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__)
rng = pd.period_range(datetime(2000, 1, 1, 0, 0), datetime(2300, 1, 1, 0, 0), freq="1D")
df = pd.DataFrame(index = rng, data = [i+1 for i in range(0,len(rng))])
resample_df = df.resample("6H").interpolate()
print(resample_df.head(5))

Issue Description

We are working with datasets that extend out past the maximum timestamp date of 2262-04-11, so we generally use period ranges rather than datetime ranges. However, starting with release 1.1.0, the resample functionality no longer works with period ranges that extend past 2262-04-11. The error that occurs in these later releases is pandas._libs.tslibs.np_datetime.OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 2300-01-01 22:59:59.

Expected Behavior

In releases prior to 1.1.0, period ranges that extend past 2262-04-11 are resampled successfully without an out of bounds datetime error.

Installed Versions

1.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team memberPeriodPeriod data typeResampleresample method

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions