October 2019
Beginner to intermediate
674 pages
16h 43m
English
A PeriodIndex function, which is an index type for a Period object, can be created in two ways:
In [305]: perRng=pd.period_range('02/01/2014','02/06/2014',freq='D')
perRng
Out[305]: <class 'pandas.tseries.period.PeriodIndex'>
freq: D
[2014-02-01, ..., 2014-02-06]
length: 6
In [306]: type(perRng[:2])
Out[306]: pandas.tseries.period.PeriodIndex
In [307]: perRng[:2]
Out[307]: <class 'pandas.tseries.period.PeriodIndex'>
freq: D
[2014-02-01, 2014-02-02]
As we can confirm from the preceding command, when you pull the covers, a PeriodIndex function is really an ndarray of Period objects.
Read now
Unlock full access