# the keyword to extract data kw = "python" pt.build_payload([kw], timeframe="all") # get the interest by country ibr = pt.interest_by_region("COUNTRY", inc_low_vol=True, inc_geo_code=True) # sort the countries by interest ibr[kw].sort_values(ascending=False) # get related topics of the keyword rt = pt.related_topics() rt[kw]["top"] # get related queries to previous keyword rq = pt.related_queries() rq[kw]["top"] # get suggested searches pt.suggestions("python") # another example of suggested searches pt.suggestions("America") # trending searches per region ts = pt.trending_searches(pn="united_kingdom") ts # real-time trending searches pt.realtime_trending_searches()
def test_realtime_trending_searches(self): pytrend = TrendReq() pytrend.build_payload(kw_list=['pizza', 'bagel']) self.assertIsNotNone(pytrend.realtime_trending_searches(pn='IN'))
interest_over_time_df = pytrend.interest_over_time() print(interest_over_time_df.head()) # Interest by Region interest_by_region_df = pytrend.interest_by_region() print(interest_by_region_df.head()) # Related Queries, returns a dictionary of dataframes related_queries_dict = pytrend.related_queries() print(related_queries_dict) # Get Google Hot Trends data trending_searches_df = pytrend.trending_searches() print(trending_searches_df.head()) # Get Google Hot Trends data today_searches_df = pytrend.today_searches() print(today_searches_df.head()) # Get Google Top Charts top_charts_df = pytrend.top_charts(2018, hl='en-US', tz=300, geo='GLOBAL') print(top_charts_df.head()) # Get Google Keyword Suggestions suggestions_dict = pytrend.suggestions(keyword='pizza') print(suggestions_dict) # Get Google Realtime Search Trends realtime_searches = pytrend.realtime_trending_searches() print(realtime_searches.head())
print(interest_over_time_df.head()) # Interest by Region interest_by_region_df = pytrend.interest_by_region() print(interest_by_region_df.head()) # Related Queries, returns a dictionary of dataframes related_queries_dict = pytrend.related_queries() print(related_queries_dict) # Get Google Hot Trends data trending_searches_df = pytrend.trending_searches() print(trending_searches_df.head()) # Get Google Hot Trends data today_searches_df = pytrend.today_searches() print(today_searches_df.head()) # Get Google Top Charts top_charts_df = pytrend.top_charts(2018, hl='en-US', tz=300, geo='GLOBAL') print(top_charts_df.head()) # Get Google Keyword Suggestions suggestions_dict = pytrend.suggestions(keyword='pizza') print(suggestions_dict) # Get Google Realtime Search Trends realtime_searches = pytrend.realtime_trending_searches(pn='IN') print(realtime_searches.head())