Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM
Machine Learning
Machine Learning
Machine Learning & AI
Manage Data
MLOps
Natural Language Processing
NumPy
Pandas
Polars
PySpark
Python Tips
Python Utilities
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

Exploring Google Trends with Pytrends API

Table of Contents

Exploring Google Trends with Pytrends API

Google Trends provides valuable insights into search patterns and public interest over time. Pytrends, an unofficial API for Google Trends, offers a simple way to access and analyze this data programmatically.

To track a keyword’s trend on Google Search, you can use pytrends. Here’s an example that shows the interest in “data science” from 2019 to 2024:

from pytrends.request import TrendReq

pytrends = TrendReq(hl="en-US", tz=360)
pytrends.build_payload(kw_list=["data science"])

df = pytrends.interest_over_time()
df["data science"].plot(figsize=(20, 7))

Pytrends allows you to easily access various types of trend data, including interest by region, related topics, and queries, making it a powerful tool for researchers, marketers, and data analysts.

Link to pytrends.

2 thoughts on “Exploring Google Trends with Pytrends API”

  1. Mahbub Khandoker

    I use the following code but didn’t see any chart! What’s wrong?
    from pytrends.request import TrendReq
    import plotly.express as px
    pytrends =TrendReq (hl=’en-US’, tz=360)
    pytrends.build_payload(kw_list=[‘Dogecoin’])
    df = pytrends.interest_over_time()
    px.line(df[‘Dogecoin’])

Leave a Comment

Your email address will not be published. Required fields are marked *

0
    0
    Your Cart
    Your cart is empty
    Scroll to Top

    Work with Khuyen Tran

    Work with Khuyen Tran