pd. period_range
>>>period_range(start=None, end=None, periods=None, freq=None, name=None)
>>>pd.period_range(start='2017-01-01', end='2018-01-01', freq='M')
>>>pd.period_range('20201010',periods=4)
pd.date_range
pd.date_range(start=None, end=None, periods=None, freq='D', tz=None, normalize=False, name=None, closed=None)
>>>pd.date_range(start="20210401 12:03:24",periods=10,freq="D",normalize=True)
pd.Period
>>>p=pd.Period("2021") #默认freq为年
Period('2021', 'A-DEC')
>>p+2
Period('2023', 'A-DEC')
>>>p1=pd.Period("2021",freq="M")
>>>p1+2
Period('2021-03', 'M')
>>> p.asfreq("M") #转换freq