pytrends
pytrends copied to clipboard
get_historical_interest timeframe is iterating - it should not!
get_historical_interest should collect data from start_date, to end_date, so the timeframe should be just start_date to end_date, but it is iterating. Above problem is causing problem with data scalling - each step has its own data scale and the collected results are crap :/
I assume that this iterating of tf is needed, to get the data, but on the other hand - it is causing such scaling problems, that data is useless.
@ostryjagoda How should it work? Could you submit a PR that makes this work properly?
The issue is Google itself. From what I can see google only allows the following timeframes (tf
):
["all", "today 5-y", "today 12-m", "today 3-m", "today 1-m", "now 7-d", "now 1-d", "now 4-H", "now 1-H"]
Depending on what you select, Google will set the data resolution for you.
By using a timeframe <=7 days the request will result in hourly data. And get_historical_intetest()
simply loops over each week and uses interest_over_time()
. This obviously means that the highest Google Trends value of that week will have value 100 and you can not really compare weeks with each other.
If you do not need hourly data you can simply keep using interest_over_time()
. That way you will get the whole history with the typical google scaling.