Python pytrends – Get trending searches from Google

In this post we will be retrieving trending search queries from Google using the pytrends API. The pytrends API allows simple interface for automating downloading of reports from Google Trends.

The trending search function of the API will take a location and so this can be changed as appropriate. The script will also return a pandas data frame.

Full source code for this project can be found below.

import pandas 
from pytrends.request import TrendReq

googleTrends = TrendReq()

Query = googleTrends.trending_searches(pn='united_states') 
df = pandas.DataFrame(Query)

print(df)

The above at the the time of writing outputs the below data frame.

the_ad id=’545′]

0            Joe Manchin
1         Draymond Green
2                    GDP
3           Quando Rondo
4              Liverpool
5          Fed rate hike
6        Brittney Griner
7      Andrew Benintendi
8         Deshaun Watson
9             Mike Trout
10           Norman Lear
11            Joe Burrow
12                 GTA 6
13          Jimmy Butler
14          Shawn Mendes
15          Max Scherzer
16                  Meta
17                 Lotto
18  Mortgage rates Today
19            NewsNation

the_ad id=’545′]

Leave a Reply