Python pytrends – Keyword suggestions from Google

In this post we will be creating a Python script that will retrieve keyword suggestions from Google, to do this we will be using the Pytrends API which allows a simple interface for downloading reports from Google Trends.

The suggestions function of the API will take a keyword via user input and return suggestions in the form of a Pandas data frame.

the_ad id=’545′]

Full source code for this project can be found below.

import pandas 
from pytrends.request import TrendReq

while True:
    Search = input("Please Enter your search query: ")
    googleTrends = TrendReq()
    Query = googleTrends.suggestions(keyword=Search)

    df = pandas.DataFrame(Query)

Leave a Reply