我是python中使用pytrends模塊的新手,它允許您從Google Trends中提取數據。這個網站給出了一個很好的介紹模塊:https://github.com/GeneralMills/pytrendspython for Google Trends:使用interest_over_time時出現「ValueError:year超出範圍」
當使用pytrend.interest_over_time()時,我收到消息「ValueError:year is out of range」。我的代碼關鍵部分是:
import pytrends
from pytrends.request import TrendReq
google_username = "" #my username
google_password = "" #my password
pytrend = TrendReq(google_username, google_password, custom_useragent=None)
pytrend.build_payload(kw_list=['Chipotle'], timeframe = 'today 5-y')
pytrend.interest_over_time()
然後我得到錯誤信息「ValueError異常:今年是超出範圍」
什麼是完整的錯誤? –
就是這麼說。但看起來有點用處: - > 128 df ['date'] = pd.to_datetime(df ['time'],unit ='s') - > 276 unit = unit,infer_datetime_format = infer_datetime_format) –