Reputation: 25
I am trying to search trends on "coronavirus" word, and for the code:
import pandas as pd
from pytrends.request import TrendReq
pytrend = TrendReq()
pytrend.build_payload(kw_list=['sintomas covid'],timeframe='2020-02-26 today', geo='BR')
# Interest Over Time
interest_over_time_df = pytrend.interest_over_time()
I keep getting:
ResponseError: The request failed: Google returned a response with code 400.
Already tried this.
Upvotes: 2
Views: 3579
Reputation: 401
It is because of timeframe parameter, it should be one of the following format
You can use this code, for your use case
import pandas as pd
from datetime import date
from pytrends.request import TrendReq
pytrend = TrendReq()
pytrend.build_payload(kw_list=['sintomas covid'],timeframe=f'2020-02-26 {date.today()}', geo='BR')
# Interest Over Time
pytrend.interest_over_time()
Upvotes: 3