import pandas as pd
index=pd.date_range('2020-1-1',periods=2)
s=pd.Series(range(1,3),index=index)
#升采样
#s.resample('6H').asfreq()
#使用前值填充
#s.resample('6H').ffill()
#使用后值填充
s.resample('6H').bfill()
2020-01-01 00:00:00 1
2020-01-01 06:00:00 2
2020-01-01 12:00:00 2
2020-01-01 18:00:00 2
2020-01-02 00:00:00 2
Freq: 6H, dtype: int64
浙公网安备 33010602011771号