Created
December 15, 2022 06:37
-
-
Save kengggg/39f35d0870f2be2704544fdc7e9e3831 to your computer and use it in GitHub Desktop.
Get the Google Trends data through pytrends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Pytrends API https://pypi.org/project/pytrends/ | |
#!pip install pytrends | |
import pandas as pd | |
import seaborn as sns | |
from pytrends.request import TrendReq | |
# create a TrendReq object | |
pytrends = TrendReq() | |
# set the keyword for which you want to get search trends | |
kw_list = ['keyword'] | |
pytrends.build_payload(kw_list, cat=0, timeframe='all', geo='TH', gprop='') | |
# get search trends data for the keyword | |
trend_data = pytrends.interest_over_time() | |
# print the search trends data | |
print(trend_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment