text_plain_output_1.png image_output_1.png
import numpy as np

import pandas as pd

def clean_ts(df):
    return df[(df['author_timestamp'] > 1104600000) & (df['author_timestamp'] < 1487807212)]
df = clean_ts(pd.read_csv('../input/linux_kernel_git_revlog.csv'))
df['author_dt'] = pd.to_datetime(df['author_timestamp'], unit='s')

time_df = df.groupby(['author_timestamp', 'author_dt'])[['n_additions', 'n_deletions']].agg(np.sum).reset_index().sort_values('author_timestamp', ascending=True)
time_df['diff'] = time_df['n_additions'] - time_df['n_deletions']

t = pd.Series(time_df['diff'].values, index=time_df['author_dt'])
t.plot(title='lines of code added')