c_m*_*lan 8 python time-series pandas autocorrelation
我正在使用 python 3.7。
我正在使用 ARIMA 模型进行时间序列预测。我正在使用自相关图评估 ARIMA 数据的属性 - 特别是使用 pandas.plotting 中的 autocorrelation_plot。
我的数据有 50,000 条左右的记录,这使得情节非常繁忙,很难找出任何特定的趋势。有没有办法限制 x 轴,使前几百个滞后更加集中?
我不能分享实际情节,但我的代码如下:
import pandas as pd
from pandas.plotting import autocorrelation_plot
#Import Data
time_series_2619 = pd.read_csv("Consumption/2619.csv", parse_dates=['Date/Time'], index_col = ['Date/Time'])['Recording']
#Auto Correlation Plot
autocorrelation_plot(time_series_2619)
Run Code Online (Sandbox Code Playgroud)
我在文档中找不到任何内容。
mrz*_*rzo 11
autocorrelation_plot返回一个 matplotlib.axis 对象。因此,您可以简单地使用该set_xlim()方法来限制 x 轴:
ax = autocorrelation_plot(time_series_2619)
ax.set_xlim([0, 500])
Run Code Online (Sandbox Code Playgroud)
或者,您可以使用该plot_acf()函数并指定滞后。
# import the plotting functions for act and pacf
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
plot_acf(df1['Thousands of Passengers'], lags=40);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5464 次 |
| 最近记录: |