File:Fidget spinner search popularity 7d rolling mean.svg
Summary
| Description |
English: The 7 day rolling mean Google Search popularity of fidget spinners in early 2017.
Íslenska: 7 daga rúllandi meðaltal vinsælda „fidget spinnara” á Google leitarvélinni snemma árið 2017.
Dansk: Udviklingen i Google Searches på fidget spinners i begyndelsen af 2017.
Հայերեն: Սպինների որոնման արդյունքները Google-ում 2017 թվականի սկզբին.
Русский: Популярность поиска спиннеров в Google в начале 2017 года.
Українська: Популярність пошуку спіннерів в Google на початку 2017 року. |
| Date | |
| Source | Own work |
| Author | Árni Dagur |
| SVG development | |
| Source code | Python codeimport matplotlib.pyplot as plt
import matplotlib.dates as dates
from pytrends.request import TrendReq
plt.rcdefaults()
plt.rcParams['figure.figsize'] = 6, 4
grid_alpha = 0.15
line_width = 1.5
username = "google username"
password = "google password"
pytrend = TrendReq(username, password, hl='en-US', tz=360, custom_useragent=None)
keyword=['fidget spinner+fidget spinners']
start_date = "2017-01-15"
end_date = "2017-06-05"
window_size = 7
#Building dataframe
pytrend.build_payload(kw_list=keyword, cat=0, timeframe='{} {}'.format(start_date, end_date))
df = pytrend.interest_over_time()
df = df.rolling(window=window_size,center=False).mean().dropna()
df[keyword] = 100*df[keyword]/df[keyword].max()
#Plotting dataframe
fig, ax = plt.subplots()
print('start_date:{} end_date:{} window_size:{}'.format(start_date, end_date, window_size))
ax.plot(df, linewidth=line_width)
ax.grid(linestyle='-', linewidth=1, alpha=grid_alpha)
ax.xaxis_date()
ax.xaxis.set_major_formatter(dates.DateFormatter('%b %d'))
fig.autofmt_xdate()
fig.tight_layout()
#Saving visualisation
fig.savefig('fidget_spinner_search_popularity_7d_rolling_mean.svg')
|
Feel free to overwrite this file with improvements.
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
| This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
| The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|