import pandas as pd
dates=['2016-01-01','2016-01-02','2016-01-03']
ts=pd.Series([1,2,3],index=pd.to_datetime(dates))
ts
print(ts['2016'])
print(ts['2016-01'])
ts.truncate(after='2016-01-02')
#舍弃前面的,丢掉后面的
#滞前,滞后操作
print(ts.shift(1))
print(ts.shift(-1))
ts.index.freq
rts = ts.resample('M',how='first')
rts
rts = ts.resample('MS',how='first')
rts