Get google trends data python9/16/2023 ![]() ![]() The related_topics() method returns a Python dictionary of each keyword this dictionary has two dataframes, one for rising topics and one for overall top topics. Related Topics and QueriesĪnother cool feature is to extract related topics of your keyword: # get related topics of the keyword You can also plot the top 10 if you wish, using ibr.sort_values(ascending=False).plot.bar(). Let's sort the countries by interest in Python: # sort the countries by interest We set inc_low_vol to True so we include the low search volume countries, we also set inc_geo_code to True to include the geocode of each country. Other possible values are 'CITY' for city-level data, 'DMA' for Metro-level data, and 'REGION' for region-level data. We pass "COUNTRY" to the interest_by_region() method to get the interest by country. Ibr = pt.interest_by_region("COUNTRY", inc_low_vol=True, inc_geo_code=True) ![]() Let's get the interest of a specific keyword by region: # the keyword to extract data Note that this method can cause Google to block your IP, as it grabs a lot of data if you specify an extended timeframe, so keep that in mind. If there's something quickly emerging, this method will definitely be helpful. Here is the output: data science isPartial ![]() You can also pass cat and geo as mentioned earlier. We set the starting and ending date and time and retrieve the results. It's suitable for short periods: # get hourly historical interest However, that's not useful if you're seeking long-term trends. Let's plot the relative search difference between Python and Java over time: # plot itĪlternatively, we can use the get_historical_interest() method which grabs hourly data. The default of this parameter is 'today 5-y' meaning the last five years.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |