Skip to content

SheryllD/googletrends

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

PyTrends Time Series Analysis

This repository contains a Jupyter Notebook that uses the pytrends API to analyse the popularity of selected keywords over time. The project focuses on identifying trends, seasonality, and residual patterns within Google search interest data.

Overview

This project demonstrates how to:

  • Connect to Google Trends via the pytrends API
  • Retrieve historical interest data for specific search terms
  • Visualise search trends for multiple keywords
  • Perform time series decomposition to uncover underlying components

This notebook explores search activity in the United States over the past five years using examples such as bitcoin, ethereum, and dogecoin, blockchain, nft.

Installation

To run this notebook, install the following Python packages:

pip install pytrends pandas matplotlib seaborn statsmodels

Recuirements

  • Written for Python 3.3+
  • Requires Requests, lxml, Pandas

Usage

  1. Open the pytrends.ipynb notebook.
  2. Define the keywords of interest.
  3. Retrieve and inspect the trend data.
  4. Visualise the trends over time.
  5. Apply seasonal decomposition to one or more keyword time series.

API

 
from pytrends.request import TrendReq # Example usage: pytrends = TrendReq(hl='en-US', tz=360) 

NOTE: You can also use proxies if you're blocked due to Google's rate limits.

 
from pytrends.request import TrendReq pytrends = TrendReq( hl='en-US', tz=360, timeout=(10, 25), proxies=['https://34.203.233.13:80'], retries=2, backoff_factor=0.1, requests_args={'verify': False} )  

Methodology

The analysis follows these main steps:

  • Connect to Google Trends with regional and time filters
  • Retrieve interest data using pytrends.build_payload
  • Display and inspect the resulting time series
  • Plot trends to compare keyword interest
  • Use statsmodels to decompose a selected time series into trend, seasonality, and residuals

This structure allows for both exploratory analysis and preparation for future predictive modelling.

Future Improvements

  • Apply decomposition to additional keywords
  • Integrate forecasting techniques such as ARIMA or Prophet
  • Combine trend data with external datasets for richer insights

Collaboration

This project started as a personal experiment. If you’re exploring similar questions, remixing the notebook, or thinking about trends in your own domain, I’d love to hear from you!

Whether you have ideas, feedback, suggestions, or just curiosity, feel free to reach out. If you spot something that could be improved or want to contribute, your perspective is more than welcome.

Let’s keep learning, testing, and building better ideas, together!

Author

Sheryll Dumapal.

Building responsible, data-driven tools with clarity and purpose.

Final Note:

Explore, build, share, and comment, and most importantly have fun!

May the force be with you.

Stay powerful,

Sheryll

About

Project: Google Trends & Keywords

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published