Skip to content

Instantly share code, notes, and snippets.

@fperez
Created December 1, 2017 10:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fperez/4e2937764f0531e329b20d2d63ff2ac9 to your computer and use it in GitHub Desktop.
Save fperez/4e2937764f0531e329b20d2d63ff2ac9 to your computer and use it in GitHub Desktop.
Release counts
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
",org,repo,tag,date\r\n",
"0,Project Jupyter,nbviewer,1.0.1,2017-10-15T03:32:54Z\r\n",
"1,Project Jupyter,nbviewer,1.0.0,2017-10-15T03:27:03Z\r\n",
"2,Project Jupyter,nbgrader,v0.5.4,2017-10-28T10:46:38Z\r\n",
"3,Project Jupyter,nbgrader,v0.5.3,2017-08-24T18:01:51Z\r\n"
]
}
],
"source": [
"!head -5 releases-2017.csv"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>org</th>\n",
" <th>repo</th>\n",
" <th>tag</th>\n",
" <th>date</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Project Jupyter</td>\n",
" <td>nbviewer</td>\n",
" <td>1.0.1</td>\n",
" <td>2017-10-15T03:32:54Z</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Project Jupyter</td>\n",
" <td>nbviewer</td>\n",
" <td>1.0.0</td>\n",
" <td>2017-10-15T03:27:03Z</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Project Jupyter</td>\n",
" <td>nbgrader</td>\n",
" <td>v0.5.4</td>\n",
" <td>2017-10-28T10:46:38Z</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Project Jupyter</td>\n",
" <td>nbgrader</td>\n",
" <td>v0.5.3</td>\n",
" <td>2017-08-24T18:01:51Z</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Project Jupyter</td>\n",
" <td>nbgrader</td>\n",
" <td>v0.5.2</td>\n",
" <td>2017-07-20T18:41:24Z</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" org repo tag date\n",
"0 Project Jupyter nbviewer 1.0.1 2017-10-15T03:32:54Z\n",
"1 Project Jupyter nbviewer 1.0.0 2017-10-15T03:27:03Z\n",
"2 Project Jupyter nbgrader v0.5.4 2017-10-28T10:46:38Z\n",
"3 Project Jupyter nbgrader v0.5.3 2017-08-24T18:01:51Z\n",
"4 Project Jupyter nbgrader v0.5.2 2017-07-20T18:41:24Z"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.read_csv(\"releases-2017.csv\", index_col=0)\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"df['date'] = pd.to_datetime(df['date'])"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"cutoff = pd.to_datetime('2016-11-30T23:59:00Z')"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"df_report = df[df['date'] > cutoff]"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"t = df_report['tag']\n",
"df_clean = df_report[t.apply(lambda x: '@' not in x)]\n",
"t = df_clean['tag']\n",
"df_clean = df_clean[t.apply(lambda x: 'beta' not in x)]\n",
"t = df_clean['tag']\n",
"df_clean = df_clean[t.apply(lambda x: 'rc' not in x)]"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"359"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(df_clean)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th>Releases</th>\n",
" </tr>\n",
" <tr>\n",
" <th>org</th>\n",
" <th>repo</th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"7\" valign=\"top\">IPython</th>\n",
" <th>disp</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ipykernel</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ipynb</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ipyparallel</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ipython</th>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ipython_genutils</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>traitlets</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"2\" valign=\"top\">Jupyter Widgets</th>\n",
" <th>ipywidgets</th>\n",
" <td>42</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyter-sphinx</th>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"13\" valign=\"top\">JupyterHub</th>\n",
" <th>configurable-http-proxy</th>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>dockerspawner</th>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>helm-chart</th>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterhub</th>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterlab-hub</th>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>kubespawner</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nbrsessionproxy</th>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nbserverproxy</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nullauthenticator</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>oauthenticator</th>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>sudospawner</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>tmpauthenticator</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>zero-to-jupyterhub-k8s</th>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"7\" valign=\"top\">JupyterLab</th>\n",
" <th>jupyter-renderers</th>\n",
" <td>9</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterlab</th>\n",
" <td>73</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterlab-github</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterlab-google-drive</th>\n",
" <td>13</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterlab_app</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterlab_launcher</th>\n",
" <td>26</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyterlab_xkcd</th>\n",
" <td>19</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"22\" valign=\"top\">Project Jupyter</th>\n",
" <th>atom-notebook</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>dashboards</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>echo_kernel</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyter-alabaster-theme</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyter-packaging</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyter_client</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyter_console</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyter_core</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jupyter_kernel_test</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>jvm-repr</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>kernel_gateway</th>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nbconvert</th>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nbdime</th>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nbformat</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nbgrader</th>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>nbviewer</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>notebook</th>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>qtconsole</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>repo2docker</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>sphinxcontrib_github_alt</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>terminado</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>testpath</th>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Releases\n",
"org repo \n",
"IPython disp 3\n",
" ipykernel 2\n",
" ipynb 1\n",
" ipyparallel 3\n",
" ipython 11\n",
" ipython_genutils 1\n",
" traitlets 1\n",
"Jupyter Widgets ipywidgets 42\n",
" jupyter-sphinx 5\n",
"JupyterHub configurable-http-proxy 7\n",
" dockerspawner 5\n",
" helm-chart 5\n",
" jupyterhub 10\n",
" jupyterlab-hub 5\n",
" kubespawner 1\n",
" nbrsessionproxy 10\n",
" nbserverproxy 4\n",
" nullauthenticator 1\n",
" oauthenticator 5\n",
" sudospawner 4\n",
" tmpauthenticator 4\n",
" zero-to-jupyterhub-k8s 7\n",
"JupyterLab jupyter-renderers 9\n",
" jupyterlab 73\n",
" jupyterlab-github 3\n",
" jupyterlab-google-drive 13\n",
" jupyterlab_app 2\n",
" jupyterlab_launcher 26\n",
" jupyterlab_xkcd 19\n",
"Project Jupyter atom-notebook 1\n",
" dashboards 1\n",
" echo_kernel 2\n",
" jupyter-alabaster-theme 3\n",
" jupyter-packaging 1\n",
" jupyter_client 3\n",
" jupyter_console 2\n",
" jupyter_core 3\n",
" jupyter_kernel_test 1\n",
" jvm-repr 3\n",
" kernel_gateway 7\n",
" nbconvert 8\n",
" nbdime 6\n",
" nbformat 3\n",
" nbgrader 8\n",
" nbviewer 2\n",
" notebook 12\n",
" qtconsole 2\n",
" repo2docker 4\n",
" sphinxcontrib_github_alt 1\n",
" terminado 3\n",
" testpath 1"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c = df_clean.drop(['date'], axis=1).groupby(['org','repo']).count()\n",
"c = c.rename({'tag': 'Releases'}, axis='columns')\n",
"c"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Releases</th>\n",
" </tr>\n",
" <tr>\n",
" <th>org</th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>IPython</th>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Jupyter Widgets</th>\n",
" <td>47</td>\n",
" </tr>\n",
" <tr>\n",
" <th>JupyterHub</th>\n",
" <td>68</td>\n",
" </tr>\n",
" <tr>\n",
" <th>JupyterLab</th>\n",
" <td>145</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Project Jupyter</th>\n",
" <td>77</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Releases\n",
"org \n",
"IPython 22\n",
"Jupyter Widgets 47\n",
"JupyterHub 68\n",
"JupyterLab 145\n",
"Project Jupyter 77"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s = c.groupby('org').sum()\n",
"s"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Releases 359\n",
"dtype: int64"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s.sum()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment