Python趋势分析

时间:2020-01-16 20:03:17

标签: python pandas dataframe

我尝试遵循有关如何通过熊猫获取趋势的教程,但是在尝试显示趋势后出现错误消息: ValueError: You must specify a freq or x must be a pandas object with a timeseries index with a freq not set to None

这是我的代码

import pandas as pd
import datetime
df = pd.read_csv('Sealevel.csv')

df['Time'] = pd.to_datetime(df['Time']
df = df.set_index('Time')

%matplotlib inline

import statsmodels.api as sm 

test = sm.tsa.seasonal_decompose(df, model='additive')
fig = test.plot()

0 个答案:

没有答案