Skip to content

Period(Index) claims to be relative to 0001-01-01 00:00:00 #9056

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

See the docstring of PeriodIndex: https://github.com/pydata/pandas/blob/master/pandas/tseries/period.py#L557, it says:

A value of 1 is the period containing the Gregorian proleptic datetime Jan 1, 0001 00:00:00.
This ordinal representation is from the scikits.timeseries project.

For instance,
    # construct period for day 1/1/1 and get the first second
    i = Period(year=1,month=1,day=1,freq='D').asfreq('S', 'S')
    i.ordinal
    ===> 1

but that is not really the truth:

In [24]: pd.Period('1970-01-01', freq='D')
Out[24]: Period('1970-01-01', 'D')

In [25]: pd.Period('1970-01-01', freq='D').ordinal
Out[25]: 0

In [34]: pd.Period(year=1,month=1,day=1,freq='D').ordinal
Out[34]: -719162

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions