Skip to content

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

Closed
@timcera

Description

@timcera

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions