Skip to content
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

BUG: PeriodIndex[B].to_timestamp drops missing days #44100

Closed
3 tasks done
jbrockmendel opened this issue Oct 19, 2021 · 0 comments · Fixed by #44935
Closed
3 tasks done

BUG: PeriodIndex[B].to_timestamp drops missing days #44100

jbrockmendel opened this issue Oct 19, 2021 · 0 comments · Fixed by #44935
Labels
Milestone

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented Oct 19, 2021

  • 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

dti = pd.date_range("2021-10-18", periods=9, freq="B")
pi = dti.to_period()

roundtrip = pi[::2].to_timestamp()  # should match dti[::2]  (except for roundtrip.freq)

>>> roundtrip
DatetimeIndex(['2021-10-18', '2021-10-19', '2021-10-20', '2021-10-21',
               '2021-10-22'],
              dtype='datetime64[ns]', freq='D')

>>> roundtrip - dti[::2]  # should be timedelta-zeros
TimedeltaIndex(['0 days', '-1 days', '-2 days', '-5 days', '-6 days'], dtype='timedelta64[ns]', freq=None)

Issue Description

PeriodArray.to_timestamp is returning incorrect results. Haven't checked if Period is affected, or other freqs.

Expected Behavior

assert (roundtrip == dti[::2]).all()

Installed Versions

Replace this line with the output of pd.show_versions()

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 19, 2021
@mroeschke mroeschke added Period Period data type Timeseries and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 30, 2021
@jreback jreback added this to the 1.4 milestone Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants