Python 熊猫自相关函数错误:';数据帧';对象没有属性';自动校准';

Python 熊猫自相关函数错误:';数据帧';对象没有属性';自动校准';,python,Python,我想在谷歌趋势历史数据中找到自相关性。非官方API使用熊猫数据帧,我决定使用其内置的自相关函数,代码如下: from pytrends.request import TrendReq z = ["animales"] google_username = "xxx@gmail.com" google_password = "xxxxxxxxx" path = "" pytrend = TrendReq(google_username, google_password, custom_user

我想在谷歌趋势历史数据中找到自相关性。非官方API使用熊猫数据帧,我决定使用其内置的自相关函数,代码如下:

from pytrends.request import TrendReq

z = ["animales"]

google_username = "xxx@gmail.com"
google_password = "xxxxxxxxx"
path = ""

pytrend = TrendReq(google_username, google_password, custom_useragent='')

pytrend.build_payload(kw_list=z, timeframe='today 5-y', geo='MX')

interest_over_time_df = pytrend.interest_over_time()

print(interest_over_time_df[z].autocorr(lag=1))
这在以前起作用,我不确定我更改了什么,我的代码抛出以下错误:

Traceback (most recent call last):
  File "C:/Users/Rafael/PycharmProjects/untitled/test.py", line 19, in <module>
     print(interest_over_time_df[z].autocorr(lag=1))
  File "C:\Users\Rafael\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandas\core\generic.py", line 2744, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'autocorr'
回溯(最近一次呼叫最后一次):
文件“C:/Users/Rafael/PycharmProjects/untitled/test.py”,第19行,在
打印(利息随时间变化[z]。自动校正(滞后=1))
文件“C:\Users\Rafael\AppData\Local\Programs\Python\Python35-32\lib\site packages\pandas\core\generic.py”,第2744行,位于\uu getattr中__
返回对象。\uuuGetAttribute(self,name)
AttributeError:“DataFrame”对象没有属性“autocorr”
某些数据帧[“col\u name”]
返回一个
序列
some_dataframe[[“col_name”]
返回一个
dataframe