In [1]:
import time
import numpy as np
import pandas
import batlabcache
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
# some setup
pandas.options.display.max_rows = 15
pandas.set_option('display.mpl_style', 'default')
now_year, now_month = time.gmtime()[:2]
# cyclusci first started using batlab in July 2013
start_year, start_month = 2013, 7
cache = batlabcache.BatlabCache(start_year, start_month, username='cyclusci')
cache.download_last_month()
In [2]:
df = cache.overview(start_year, start_month, now_year, now_month)
df
Out[2]:
In [3]:
# durration is in seconds
dur = df['duration'].sum()
print("{0:.2f} hrs".format(dur/3600.0))
In [4]:
df.result.value_counts()
Out[4]:
In [5]:
ax = (df.duration/3600.0).plot(figsize=(15, 6))
ax.set_ylabel("Duration [hrs]")
Out[5]:
In [6]:
monthly = df.groupby([df.index.year, df.index.month]).transform(np.sum)
In [7]:
ax = (monthly.duration/3600.0).plot(figsize=(15, 6))
ax.set_ylabel("Duration [hrs]")
Out[7]:
In [ ]: