Closed
Description
On master:
In [1]: import pandas as pd; pd.__version__
Out[1]: '0.24.0.dev0+1340.g8c58817bd'
In [2]: pi = pd.period_range('2018-01-01', periods=3, freq='2D')
In [3]: pi
Out[3]: PeriodIndex(['2018-01-01', '2018-01-03', '2018-01-05'], dtype='period[2D]', freq='2D')
In [4]: pi._shallow_copy(pi.asi8, freq=pi.freq)
Out[4]: PeriodIndex(['2018-01-02', '2018-01-04', '2018-01-06'], dtype='period[2D]', freq='2D')
It appears that values are shifted forward by freq.n - 1
base frequencies, e.g. if freq='5D'
then the above will result in a shift of '2018-01-01'
--> '2018-01-05'
.
Note that this is working on 0.23.4:
In [1]: import pandas as pd; pd.__version__
Out[1]: '0.23.4'
In [2]: pi = pd.period_range('2018-01-01', periods=3, freq='2D')
In [3]: pi
Out[3]: PeriodIndex(['2018-01-01', '2018-01-03', '2018-01-05'], dtype='period[2D]', freq='2D')
In [4]: pi._shallow_copy(pi.asi8, freq=pi.freq)
Out[4]: PeriodIndex(['2018-01-01', '2018-01-03', '2018-01-05'], dtype='period[2D]', freq='2D')
cc @jbrockmendel : Am I correct in expecting that Out[3]
and Out[4]
should be the same?