Skip to content

BUG: Series.resample fails on NaT PeriodIndex #39227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rhshadrach opened this issue Jan 17, 2021 · 0 comments · Fixed by #39229
Closed

BUG: Series.resample fails on NaT PeriodIndex #39227

rhshadrach opened this issue Jan 17, 2021 · 0 comments · Fixed by #39229
Assignees
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Resample resample method Series Series data structure
Milestone

Comments

@rhshadrach
Copy link
Member

Failure is only on Series and only when the index is entirely NaT.

freq = "D"

df = DataFrame([1, 2], index=PeriodIndex([NaT, NaT], freq=freq))
print(df.resample(freq).sum())

ser = Series([1, 2], index=PeriodIndex([NaT, NaT], freq=freq))
print(ser.resample(freq).sum())

Second raises, first returns the expected

Empty DataFrame
Columns: []
Index: []
@rhshadrach rhshadrach added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Resample resample method Series Series data structure labels Jan 17, 2021
@rhshadrach rhshadrach self-assigned this Jan 17, 2021
@rhshadrach rhshadrach changed the title BUG: Series.resample fails on NaT index BUG: Series.resample fails on NaT PeriodIndex Jan 17, 2021
@jreback jreback added this to the 1.3 milestone Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Resample resample method Series Series data structure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants