如何使用matplotlib.pyplot.acorr的去趋势功能?

2024-10-05 20:07:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我是一个Python初学者。在运行自相关分析之前,我尝试使用matplotlib中的acorr对时间序列进行去趋势化。但是语法上有些东西我不懂。你知道吗

Matplotlib的网站(https://matplotlib.org/3.1.0/api/_as_gen/matplotlib.pyplot.acorr.html)描述了如何将detrending与acorr函数一起使用:“x由detrendcallable进行detrended。这必须是函数x=detrend(x)接受并返回numpy.数组“我一定是看错了,因为我用的代码不起作用。你知道吗

失败的尝试:

plt.acorr(values, detrend=True)
plt.acorr(values, detrend="linear")
plt.acorr(values=detrend(values))

正如你所看到的,一些关于语法或matplotlib的基本事实让我不知所措。请帮忙。你知道吗


Tags: 函数httpsorgmatplotlib网站时间语法plt