#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd from IPython.display import IFrame, HTML # ## Fetch and preprocess json # In[2]: user, repository = 'd3', 'd3' data = pd.read_json(f'https://api.github.com/repos/{user}/{repository}/stats/punch_card') data.columns = ['dow', 'hour', 'contributions'] data.head() # ## Save to local # In[3]: data.to_json('contributions.json', orient='records') # ## Plot using d3.js # In[4]: get_ipython().system('cat punchcard.html') # In[5]: IFrame(src="punchcard.html", width=650, height=250) # In[ ]: