我对熊猫数据帧预测非常陌生。我有一个简单的数据框,如下所示:
我希望在未来三年内预测fraction
,例如2019、2020和2021。
到目前为止,我的代码如下:
df=pd.read_csv("by_tag_year.csv", index_col=None)
df
df['year'] = pd.to_datetime(df.year, format='%Y')
df['fraction'] = df ['number'] / df['year_total']
df.fraction = df.fraction.round(4)
programming_lang = ["r", "python", "c#", "java", "JavaScript", "php", "c++", "ruby", "Selenium"]
yearly_top = df[df['tag'].isin(programming_lang)]
sns.set(rc={'figure.figsize':(15,10)})
sns.lineplot(data=yearly_top, x='year', y='fraction', hue='tag')
yearly_python = df[df['tag']=='python']
yearly_python = yearly_python.iloc[: , [0, 4]].copy()
yearly_python = yearly_python.filter(['year','fraction'], axis=1)
yearly_python
任何线索都将非常有帮助。我已经检查了此链接Forecasting with time series in python,但是它给了我一个错误'DataFrame' object has no attribute 'TimeSeries'