Ich möchte Autokorrelation in Google Trends historische Daten finden. Die inoffizielle API verwendet Pandas Dataframes, für die ich beschlossen, die in Autokorrelationsfunktion gebaut zu verwenden, hier ist der Code:Pandas Autokorrelationsfunktion Fehler: 'DataFrame' Objekt hat kein Attribut 'Autokorrektur'
from pytrends.request import TrendReq
z = ["animales"]
google_username = "[email protected]"
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))
Dieses gearbeitet hat und bin nicht sicher, was habe ich zu ändern, meinen Code führt den folgenden Fehler:
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'