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

Suggest using ISO 8601 for display of Period and PeriodIndex #1776

Closed
timcera opened this issue Aug 17, 2012 · 1 comment

Comments

@timcera
Copy link
Contributor

commented Aug 17, 2012

As of pandas 0.8.1, the Period and PeriodIndex display uses the English abbreviations for the month. Suggest that ISO 8601, would be a better choice.

Annual Period is fine...

z =PeriodIndex([Period('2012'), Period('2013')])

z
Out[182]:
<class 'pandas.tseries.period.PeriodIndex'>
freq: A-DEC
[2012, ..., 2013]
length: 2

Monthly though...

In [185]: z =PeriodIndex([Period('2012-01'), Period('2012-02')])

In [186]: z
Out[186]:
<class 'pandas.tseries.period.PeriodIndex'>
freq: M
[Jan-2012, ..., Feb-2012]
length: 2

I think that 'z' instead should be:

In [186]: z
Out[186]:
<class 'pandas.tseries.period.PeriodIndex'>
freq: M
[2012-01, ..., 2012-02]
length: 2

Hourly currently is

z =PeriodIndex([Period('2012-01-01 00', freq='H'), Period('2012-01-01 01', freq='H')])

z
Out[193]:
<class 'pandas.tseries.period.PeriodIndex'>
freq: H
[01-Jan-2012 00:00, ..., 01-Jan-2012 01:00]
length: 2

The ISO 8601 standard representation of hourly Periods would be:

In [186]: z
Out[186]:
<class 'pandas.tseries.period.PeriodIndex'>
freq: M
[2012-01-01 00, ..., 2012-01-01 01]
length: 2

Advantages:
Not English centric
Directly sortable chronologically without parsing

Kindest regards,
Tim

@wesm

This comment has been minimized.

Copy link
Member

commented Aug 30, 2012

Agreed

@wesm wesm closed this in 7a83180 Sep 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.