text_plain_output_1.png image_output_1.png
from collections import Counter

import numpy as np

import operator

import pandas as pd

import seaborn as sns

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'])

commits_over_time = df.groupby('author_dt')['commit_hash'].nunique().reset_index().sort_values('author_dt', ascending=True)
commits_series = pd.Series(commits_over_time['commit_hash'].values, index=commits_over_time['author_dt'])

files_changed_per_commit = df.groupby(['author_dt', 'commit_hash'])['filename'].agg('count').reset_index().sort_values('author_dt', ascending=True)
files_changed_per_commit = pd.Series(files_changed_per_commit['filename'].values, index=files_changed_per_commit['author_dt'])

files_changed_per_utc_offset = df.groupby('commit_utc_offset_hours')['filename'].agg('count').reset_index().sort_values('filename', ascending=False)

n_authors_by_offset = df.groupby('commit_utc_offset_hours')['author_id'].nunique().reset_index().sort_values('author_id', ascending=False)

from collections import Counter
import operator
n_rows = 10000.0
subject_words = []
for row_number, row in df.ix[0:n_rows].iterrows():
    ws = row['subject'].split(' ')
    subject_words = subject_words + [w.lower() for w in ws]
words = []
counts = []
for word, count in sorted(Counter(subject_words).items(), key=operator.itemgetter(1), reverse=True):
    words.append(word)
    counts.append(count)

wcdf = pd.DataFrame({'word': words, 'count': counts})
sns.barplot(y='word', x='count', data=wcdf[0:20])