【发布时间】:2019-07-08 05:34:02
【问题描述】:
我是 Python 初学者。我试图通过在 matplotlib 中使用 acorr 在运行自相关分析之前消除时间序列的趋势。但是我无法理解语法。
Matplotlib 的网站 (https://matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.acorr.html) 描述了如何将去趋势与 acorr 函数一起使用:“x 被 detrend 可调用对象去趋势。这必须是一个函数 x = detrend(x) 接受并返回一个 numpy.array。”我一定是看错了,因为我使用的代码不起作用。
尝试失败:
plt.acorr(values, detrend=True)
plt.acorr(values, detrend="linear")
plt.acorr(values=detrend(values))
如您所见,一些关于语法或 matplotlib 的基本事实让我无法理解。请帮忙。
【问题讨论】:
标签: python matplotlib autocorrelation