Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
pd.period_range(start='2018-02-02', end='2019-02-02', freq='M')
Out[2]:
PeriodIndex(['2018-02', '2018-03', '2018-04', '2018-05', '2018-06', '2018-07',
             '2018-08', '2018-09', '2018-10', '2018-11', '2018-12', '2019-01',
             '2019-02'],
            dtype='period[M]', freq='M')

If start or end are Period objects, they will be used as anchor endpoints for a PeriodIndex with frequency
matching that of the period_range constructor.

In [3]:
pd.period_range(start=pd.Period('2018Q2', freq='Q'),
                end=pd.Period('2018Q3', freq='Q'), freq='M')
Out[3]:
PeriodIndex(['2018-06', '2018-07', '2018-08', '2018-09'], dtype='period[M]', freq='M')