In [9]:
import pandas as pd

def read_timestamp(path):
    df = pd.read_csv(
        path,
        names=["timestamp"],
        date_parser=pd.to_datetime,
        index_col=0
    )
    df['commit'] = 1
    df = df.resample('W').count()
    return df

In [10]:
lerna = read_timestamp(r'C:/dev/forensic/lerna/timestamps.log')
lerna.head()


Out[10]:
commit
timestamp
2015-12-06 18
2015-12-13 2
2015-12-20 1
2015-12-27 5
2016-01-03 1

In [11]:
rush = read_timestamp(r'C:/dev/forensic/web-build-tools/timestamps.log')
rush.head()


Out[11]:
commit
timestamp
2016-01-03 8
2016-01-10 0
2016-01-17 1
2016-01-24 3
2016-01-31 1

In [15]:
comp = lerna.join(rush, lsuffix="_lerna", rsuffix='_rush').fillna(0)
comp['punch_lerna'] = comp.commit_lerna.clip_upper(1)
comp['punch_rush'] = comp.commit_rush.clip_upper(1)
comp.head()


Out[15]:
commit_lerna commit_rush punch_lerna punch_rush
timestamp
2015-12-06 18 0.0 1 0.0
2015-12-13 2 0.0 1 0.0
2015-12-20 1 0.0 1 0.0
2015-12-27 5 0.0 1 0.0
2016-01-03 1 8.0 1 1.0

In [20]:
import pygal

line_chart = pygal.StackedBar()
line_chart.add('Lerna', comp.commit_lerna)
line_chart.add('Rush', comp.commit_rush)
line_chart.render_in_browser()


file://C:/Users/Markus/AppData/Local/Temp/tmp9pr_6tcv.html

In [19]:
line_chart = pygal.StackedBar()
line_chart.add('Lerna', comp.punch_lerna)
line_chart.add('Rush', comp.punch_rush)
line_chart.render_in_browser()


file://C:/Users/Markus/AppData/Local/Temp/tmpv3lc3lxx.html