#! /usr/bin/env python
'''
Adapted from here: https://raw.github.com/bigsnarfdude/github_team_calendars/master/data_geeks_team_calendar.ipynb
Python program to scrape friends github to build team calendar for github
Note, this only refers to public repos.
'''
import json
import requests
import pandas as pd
def line_draw_target(target):
github_url = 'https://github.com/users/%s/contributions_calendar_data'
r = requests.get(github_url % target)
data = json.loads(r.text)
dates, contributions = zip(*data)
ts = pd.Series(contributions, index=dates)
plt.plot(ts)
print ts.describe()
print "distribution of commit counts"
print ts.value_counts().sort_index()
target = "lexual"
line_draw_target(target)
count 367.000000 mean 0.073569 std 0.434237 min 0.000000 25% 0.000000 50% 0.000000 75% 0.000000 max 6.000000 distribution of commit counts 0 352 1 7 2 7 6 1
target = "mafrosis"
line_draw_target(target)
count 367.000000 mean 0.566757 std 1.474848 min 0.000000 25% 0.000000 50% 0.000000 75% 0.000000 max 9.000000 distribution of commit counts 0 290 1 34 2 14 3 7 4 5 5 8 6 3 7 3 8 1 9 2
target = "ajfisher"
line_draw_target(target)
count 367.000000 mean 0.188011 std 0.980726 min 0.000000 25% 0.000000 50% 0.000000 75% 0.000000 max 14.000000 distribution of commit counts 0 342 1 9 2 6 3 5 4 1 5 3 14 1
target = "van-jba"
line_draw_target(target)
count 367.000000 mean 0.035422 std 0.258936 min 0.000000 25% 0.000000 50% 0.000000 75% 0.000000 max 3.000000 distribution of commit counts 0 359 1 4 2 3 3 1
target = "wesm" # pandas dude
line_draw_target(target)
count 367.000000 mean 5.855586 std 6.173127 min 0.000000 25% 1.000000 50% 4.000000 75% 9.000000 max 29.000000 distribution of commit counts 0 71 1 46 2 30 3 31 4 23 5 22 6 15 7 15 8 14 9 10 10 8 11 16 12 11 13 9 14 10 15 4 16 4 17 8 18 3 20 2 21 7 22 1 24 2 25 1 26 1 27 1 28 1 29 1
target = "thatch45" # salt dude.
line_draw_target(target)
count 367.000000 mean 11.337875 std 9.085222 min 0.000000 25% 4.000000 50% 10.000000 75% 16.000000 max 53.000000 distribution of commit counts 0 21 1 20 2 21 3 16 4 24 5 15 6 20 7 15 8 14 9 14 10 12 11 19 12 15 13 17 14 12 15 9 16 14 17 6 18 10 19 8 20 10 21 4 22 4 23 8 24 6 25 3 26 3 27 5 28 2 29 5 30 2 31 2 32 2 33 1 34 2 35 1 36 1 39 1 40 1 47 1 53 1
target = "stephenmcd" # Mezzanine dude.
line_draw_target(target)
count 367.000000 mean 5.746594 std 8.053346 min 0.000000 25% 1.000000 50% 3.000000 75% 8.000000 max 74.000000 distribution of commit counts 0 80 1 46 2 34 3 31 4 24 5 16 6 22 7 16 8 26 9 9 10 9 11 4 12 5 13 2 14 6 15 3 16 7 17 3 18 5 20 2 21 2 22 2 23 2 25 2 27 1 29 2 31 1 38 1 39 1 44 1 58 1 74 1