File:Fidget spinner search popularity 7d rolling mean.svg

Original file (SVG file, nominally 540 × 360 pixels, file size: 25 KB)

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
InfoField
 
The source code of this SVG is invalid due to an error.
 
This W3C-invalid plot was created with Matplotlib.
Source code
InfoField

Python code

import 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:
Creative Commons CC-Zero 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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

26 May 2017

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current23:33, 4 July 2017Thumbnail for version as of 23:33, 4 July 2017540 × 360 (25 KB)ArniDagurupdated file with more data, increased grid alpha
18:59, 14 June 2017Thumbnail for version as of 18:59, 14 June 2017540 × 360 (27 KB)ArniDagurFile upload bug uploading old file?
18:50, 13 June 2017Thumbnail for version as of 18:50, 13 June 2017540 × 360 (27 KB)ArniDagurfile upload bug?
18:48, 13 June 2017Thumbnail for version as of 18:48, 13 June 2017540 × 360 (27 KB)ArniDaguradded grid, added more data
21:02, 26 May 2017Thumbnail for version as of 21:02, 26 May 2017540 × 360 (27 KB)ArniDagurUser created page with UploadWizard

The following page uses this file:

Metadata