pd resample方法有groupby的作用

rng=pd.date_range(‘2000-01-01’,periods=100,freq=‘D’)
ts=pd.DataFrame(np.random.randn(len(rng)),index=rng)
ts.resample(‘M’).mean()
0
2000-01-31 0.088815
2000-02-29 -0.114523
2000-03-31 -0.112042
2000-04-30 0.093860

ts.resample(‘M’).max()
0
2000-01-31 2.124900
2000-02-29 1.860762
2000-03-31 1.704335
2000-04-30 1.392303

ts.resample(‘M’).std()
0
2000-01-31 1.088187
2000-02-29 1.286424
2000-03-31 0.957022
2000-04-30 0.886836

猜你喜欢

转载自blog.csdn.net/weixin_43055882/article/details/88141409