时间序列基础
import pandas as pd # 创建时间序列 dates = pd.date_range('2023-01-01', periods=365, freq='D') ts = pd.Series(np.random.randn(365), index=dates) # 重采样 monthly = ts.resample('M').mean()
趋势分析
# 移动平均 ts.rolling(window=30).mean() # 指数平滑 ts.ewm(span=30).mean()
转载请注明:周志洋的博客 » Python数据分析-时间序列分析