pandas处理时间序列:
生成一段时间的索引:
date = pd.date_range(start='20220101', end='20220701')
print(date)
DatetimeIndex(['2022-01-01', '2022-01-02', '2022-01-03', '2022-01-04',
'2022-01-05', '2022-01-06', '2022-01-07', '2022-01-08',
'2022-01-09', '2022-01-10',
...
'2022-06-22', '2022-06-23', '2022-06-24', '2022-06-25',
'2022-06-26', '2022-06-27', '2022-06-28', '2022-06-29',
'2022-06-30', '2022-07-01'],
dtype='datetime64[ns]', length=182, freq='D')
.resample()可以实现频率转化
.PeriodIndex(year=, month=, day=, …)可以将表格中分开的时间数据变成常见的格式