Reputation: 23
I'm trying to get the dailydata of Google Trend through the method: pytrends.dailydata.get_daily_data().
The link here just tells me the default value of the geo parameter is "US". I'd like to know where I can find a whole list of possible values. I have tried "GLOBAL", but got an error.
My code is as follow:
from pytrends import dailydata
df = dailydata.get_daily_data('cinema', 2019, 1, 2019, 6, geo='GLOBAL')
print(df)
And I got the error message as:
The request failed: Google returned a response with code 400. Trying again in 60 seconds.
If I replace "GLOBAL" with "US", it worked. So, did I miss anything, or did I do anything wrong? Thank you very much!
Upvotes: 0
Views: 1040
Reputation: 396
I think for global you have to pass an empty string:
df = dailydata.get_daily_data('cinema', 2019, 1, 2019, 6, geo='')
I think google uses ISO 3166 for location.
In that list you can also find regions if you click on the countries, for example if you want trends in US Alabama, you can use the geo code US-AL
.
I am not sure if all the codes there are supported by google, but you can try the ones you need.
Upvotes: 1