0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pytrendでトレンドデータを取得する

Posted at

はじめに

Google Trends の非公式APIであるpytrends を使ってみました
https://github.com/GeneralMills/pytrends/blob/master/README.md

install

pip install pytrends

実際に取得してみる

2つのwordに対してトレンドデータを取得してみます
最近(2025年1月末)話題になった中国AIベンチャーDeepSeekとToyotaのトレンドデータを比較します
kw_list[]でワードを、timeframeで期間を指定しています

from pytrends.request import TrendReq
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt

pytrend = TrendReq()
pytrend.build_payload(kw_list=['DeepSeek', 'Toyota'], timeframe=['2025-01-01 2025-02-01', '2025-01-01 2025-02-01'])
interest_over_time_df = pytrend.interest_over_time()

interest_over_time_df.plot()
plt.show()

実行結果

DeepSeekが急速に話題になったことが確認できます
Figure_1.png

まとめ

pytrends を使用してトレンドを時系列データとして表示してみました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?