Last active
December 17, 2017 14:20
-
-
Save smokinggoats/641abc5e5341e056921f2bf1861e5f2f to your computer and use it in GitHub Desktop.
speedtest-cli csv data analysis collected during a year
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib | |
import os | |
import datetime | |
% matplotlib inline | |
dir_name = os.path.abspath('./') | |
file_path = os.path.join(dir_name, 'speed-tests.csv') | |
df = pd.read_csv(file_path) | |
df['timestamp'] = pd.to_datetime(df.pop('dt')) | |
df['download'] /= 8000 | |
df['upload'] /= 8000 | |
df['ping'] /= 1000 | |
df.dropna(how='any') | |
# df.describe() | |
df.index = df['timestamp'] | |
# mask = (df.timestamp >= datetime.datetime(2017, 12, 1)) & (df.timestamp < datetime.datetime(2017, 12, 2)) | |
m = pd.DataFrame.groupby(df, by=[df.index.month, df.index.year]).mean() | |
m.unstack(level=1).plot(y=['download','upload'], figsize=(15, 10), grid=True, xticks=[x for x in range(1,13)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment