这是我的密码:
def plot_and_store(df,method_name):
'''
Plots the given time indexed data frame and stores the plots in the folder
'''
for i in range(1,8):
column_name = "T"+str(i) + "_FWD"
series = df[column_name]
plot = series
我希望从一个文件中读取数据(日期和数量列),并用ARIMA预测将它们绘制到图表上。
不幸的是,我用过的在线指南并不走运,每个指南都给我带来了不同的问题。
以下是我的基本代码(它只绘制数据而不显示预测):
from pandas import Series
from matplotlib import pyplot
from statsmodels.tsa.arima_model import ARIMA
series = Series.from_csv('Quantity.csv',header=0)
model = ARIMA(series, order=(2,0,1))
我有下面的代码来生成时间序列图
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
series = pd.Series([np.sin(ii*np.pi) for ii in range(30)],
index=pd.date_range(start='2019-01-01', end='2019-12-31',
periods=30))
series.plot(ax=a
我正在尝试绘制一些简单的时间序列,通常它工作得很好,但这个特例没有得到预期的结果: 我在Visual Studio和CLI中运行代码,在那里我得到了相同的错误消息。但是,当我尝试在jupyter笔记本中运行相同的代码时,我得到了三个单元格(CELL1、CELL2和CELL3分开),整个代码运行得很好。只有当我将CELL2和CELL3放在一个单元格中时,它才再次产生典型的错误。 # CELL 1
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import datetime
from pandas i