Skip to content

Missing Periods for some DateOffsets #5091

Open
@cancan101

Description

@cancan101

There are not corresponding Periods for many DateOffsets.

For example see how the freq changes:

ts = pd.date_range('1/1/2012', periods=4, freq=pd.offsets.BQuarterEnd())
per = ts.to_period()
ts_per = per.to_timestamp()

In [210]: ts
Out[210]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2012-03-30 00:00:00, ..., 2012-12-31 00:00:00]
Length: 4, Freq: BQ-MAR, Timezone: None

In [211]: per
Out[211]: 
<class 'pandas.tseries.period.PeriodIndex'>
freq: Q-DEC
[2012Q1, ..., 2012Q4]
length: 4

In [212]: ts_per
Out[212]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2012-01-01 00:00:00, ..., 2012-10-01 00:00:00]
Length: 4, Freq: QS-OCT, Timezone: None

This issue is alluded to in comment: https://github.com/pydata/pandas/blob/master/pandas/tseries/frequencies.py#L329

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