Skip to content

BUG: Wrong order and ambiguous start point for some period values #36593

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
GYHHAHA opened this issue Sep 24, 2020 · 4 comments
Closed

BUG: Wrong order and ambiguous start point for some period values #36593

GYHHAHA opened this issue Sep 24, 2020 · 4 comments
Labels
Duplicate Report Duplicate issue or pull request

Comments

@GYHHAHA
Copy link
Contributor

GYHHAHA commented Sep 24, 2020

>>>pd.period_range('1350-01-01', '1350-01-02', freq='6h').sort_values()
PeriodIndex(['1350-01-01 23:00', '1350-01-01 05:00', '1350-01-01 11:00',
             '1350-01-01 17:00', '1350-01-02 23:00'],
            dtype='period[6H]', freq='6H')

Though sorted, '1350-01-01 23:00' still locates the first.

>>>pd.period_range('2150-01-01', '2150-01-02', freq='6h')
PeriodIndex(['2150-01-01 00:00', '2150-01-01 06:00', '2150-01-01 12:00',
             '2150-01-01 18:00', '2150-01-02 00:00'],
            dtype='period[6H]', freq='6H')

And why this starts at 00:00, but the former one starts at 23:00?

Thanks!

@GYHHAHA GYHHAHA added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 24, 2020
@phofl
Copy link
Member

phofl commented Sep 24, 2020

Hey, thanks for your report. This is actually a duplicate of #36294 and will be fixed with #36557

@phofl phofl added Duplicate Report Duplicate issue or pull request and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 24, 2020
@GYHHAHA
Copy link
Contributor Author

GYHHAHA commented Sep 24, 2020

Hi, is this actually a duplication?

>>>pd.period_range('1400-01-01', '1400-01-02', freq='6h')
PeriodIndex(['1400-01-01 00:00', '1400-01-01 06:00', '1400-01-01 12:00',
             '1400-01-01 18:00', '1400-01-02 00:00'],
            dtype='period[6H]', freq='6H')

It seems to be normal though '1400' is also a pre epoch.

Thanks! @phofl

@phofl
Copy link
Member

phofl commented Sep 24, 2020

You are right, may be unrelated, but is fixed on master.

Sorry for the confusion: This is a duplicate of #36430 and was fixed by #36535

@GYHHAHA
Copy link
Contributor Author

GYHHAHA commented Sep 24, 2020

great

close

@GYHHAHA GYHHAHA closed this as completed Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants