time_series Indexing & Moving Average

通过panda.read_csv 来读取dataframe. 设置Index Column = "Month" 自定义的本来是1,2,3,4..

time_series Indexing & Moving Average_第1张图片


time_series Indexing & Moving Average_第2张图片

Simple Moving Average: 采用rolling(window = months).mean() 取过去几个月的mean value

能够看到只要是Simple Moving Average的线,不管是6个月还是12个月average.都出现了lags

Original data一开始的部分没有对应的line.

time_series Indexing & Moving Average_第3张图片

Dataframe.plot(figsize=(width, height))

time_series Indexing & Moving Average_第4张图片

使用Exponential weighted average之后似乎解决了lag问题。但是beginning trend 不明显

time_series Indexing & Moving Average_第5张图片


time_series Indexing & Moving Average_第6张图片

你可能感兴趣的:(time_series Indexing & Moving Average)