Skip to content

Instantly share code, notes, and snippets.

@Julian
Created December 15, 2021 13:48
Show Gist options
  • Save Julian/3cb202d9461e73b6c06dd564683f5118 to your computer and use it in GitHub Desktop.
Save Julian/3cb202d9461e73b6c06dd564683f5118 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 49,
"id": "5582627c-7dcf-41a7-8634-f5cdb86c6f47",
"metadata": {},
"outputs": [],
"source": [
"from git import Repo\n",
"repo = Repo(\"/Users/Julian/Desktop/mathlib\")"
]
},
{
"cell_type": "code",
"execution_count": 73,
"id": "019ccb68-b32f-4ede-83d7-ffa0152d7ace",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'total_changed_files': 5,\n",
" 'file': 'src/measure_theory/function/l1_space.lean',\n",
" 'area': 'measure_theory',\n",
" 'file_insertions': 8,\n",
" 'file_deletions': 3,\n",
" 'file_total_changes': 11,\n",
" 'total_changes': 644,\n",
" 'author': 'Rémy Degenne',\n",
" 'authored_date': DateTime(2021, 12, 14, 14, 14, 24, tzinfo=Timezone('UTC')),\n",
" 'committer': 'Rémy Degenne',\n",
" 'committed_date': DateTime(2021, 12, 14, 14, 14, 24, tzinfo=Timezone('UTC')),\n",
" 'hexsha': 'e3eb0eb024dd2c436c94d3e7386c70f50c5f1261',\n",
" 'num_parents': 1,\n",
" 'commit': <git.Commit \"e3eb0eb024dd2c436c94d3e7386c70f50c5f1261\">}"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pendulum\n",
"data = (\n",
" {\n",
" \"total_changed_files\": len(commit.stats.files),\n",
" \"file\": file,\n",
" \"area\": file.split(\"/\")[1] if \"/\" in file else None,\n",
" \"file_insertions\": stats[\"insertions\"],\n",
" \"file_deletions\": stats[\"deletions\"],\n",
" \"file_total_changes\": stats[\"lines\"],\n",
" # file_length_before: _,\n",
" \"total_changes\": sum(stat[\"lines\"] for stat in commit.stats.files.values()),\n",
" \"author\": commit.author.name,\n",
" \"authored_date\": pendulum.from_timestamp(commit.authored_date),\n",
" \"committer\": commit.committer.name,\n",
" \"committed_date\": pendulum.from_timestamp(commit.committed_date),\n",
" \"hexsha\": commit.hexsha,\n",
" \"num_parents\": len(commit.parents),\n",
" \"commit\": commit,\n",
" }\n",
" for commit in repo.iter_commits()\n",
" for file, stats in commit.stats.files.items()\n",
")\n",
"next(data)"
]
},
{
"cell_type": "code",
"execution_count": 74,
"id": "e84c915d-c75c-4f45-befc-bb6623e21101",
"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>total_changed_files</th>\n",
" <th>file</th>\n",
" <th>area</th>\n",
" <th>file_insertions</th>\n",
" <th>file_deletions</th>\n",
" <th>file_total_changes</th>\n",
" <th>total_changes</th>\n",
" <th>author</th>\n",
" <th>authored_date</th>\n",
" <th>committer</th>\n",
" <th>committed_date</th>\n",
" <th>hexsha</th>\n",
" <th>num_parents</th>\n",
" <th>commit</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/function/lp_space.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>13</td>\n",
" <td>0</td>\n",
" <td>13</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/integral/bochner.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/integral/set_to_l1.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>601</td>\n",
" <td>13</td>\n",
" <td>614</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/measure/measure_space.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>4</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>src/algebraic_geometry/locally_ringed_space/ha...</td>\n",
" <td>algebraic_geometry</td>\n",
" <td>111</td>\n",
" <td>0</td>\n",
" <td>111</td>\n",
" <td>224</td>\n",
" <td>Andrew Yang</td>\n",
" <td>2021-12-14 12:57:08+00:00</td>\n",
" <td>Andrew Yang</td>\n",
" <td>2021-12-14 12:57:08+00:00</td>\n",
" <td>1367c19b1b5d53ec699e4003f7aaa40a8099a643</td>\n",
" <td>1</td>\n",
" <td>1367c19b1b5d53ec699e4003f7aaa40a8099a643</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43727</th>\n",
" <td>71</td>\n",
" <td>topology/continuity.lean</td>\n",
" <td>continuity.lean</td>\n",
" <td>331</td>\n",
" <td>0</td>\n",
" <td>331</td>\n",
" <td>22461</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43728</th>\n",
" <td>71</td>\n",
" <td>topology/topological_space.lean</td>\n",
" <td>topological_space.lean</td>\n",
" <td>622</td>\n",
" <td>0</td>\n",
" <td>622</td>\n",
" <td>22461</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43729</th>\n",
" <td>71</td>\n",
" <td>topology/uniform_space.lean</td>\n",
" <td>uniform_space.lean</td>\n",
" <td>1127</td>\n",
" <td>0</td>\n",
" <td>1127</td>\n",
" <td>22461</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43730</th>\n",
" <td>2</td>\n",
" <td>LICENSE</td>\n",
" <td>None</td>\n",
" <td>201</td>\n",
" <td>0</td>\n",
" <td>201</td>\n",
" <td>203</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" <td>0</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43731</th>\n",
" <td>2</td>\n",
" <td>README.md</td>\n",
" <td>None</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>203</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" <td>0</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>43732 rows × 14 columns</p>\n",
"</div>"
],
"text/plain": [
" total_changed_files file \\\n",
"0 5 src/measure_theory/function/lp_space.lean \n",
"1 5 src/measure_theory/integral/bochner.lean \n",
"2 5 src/measure_theory/integral/set_to_l1.lean \n",
"3 5 src/measure_theory/measure/measure_space.lean \n",
"4 5 src/algebraic_geometry/locally_ringed_space/ha... \n",
"... ... ... \n",
"43727 71 topology/continuity.lean \n",
"43728 71 topology/topological_space.lean \n",
"43729 71 topology/uniform_space.lean \n",
"43730 2 LICENSE \n",
"43731 2 README.md \n",
"\n",
" area file_insertions file_deletions \\\n",
"0 measure_theory 13 0 \n",
"1 measure_theory 1 1 \n",
"2 measure_theory 601 13 \n",
"3 measure_theory 4 0 \n",
"4 algebraic_geometry 111 0 \n",
"... ... ... ... \n",
"43727 continuity.lean 331 0 \n",
"43728 topological_space.lean 622 0 \n",
"43729 uniform_space.lean 1127 0 \n",
"43730 None 201 0 \n",
"43731 None 2 0 \n",
"\n",
" file_total_changes total_changes author \\\n",
"0 13 644 Rémy Degenne \n",
"1 2 644 Rémy Degenne \n",
"2 614 644 Rémy Degenne \n",
"3 4 644 Rémy Degenne \n",
"4 111 224 Andrew Yang \n",
"... ... ... ... \n",
"43727 331 22461 Mario Carneiro \n",
"43728 622 22461 Mario Carneiro \n",
"43729 1127 22461 Mario Carneiro \n",
"43730 201 203 Leonardo de Moura \n",
"43731 2 203 Leonardo de Moura \n",
"\n",
" authored_date committer committed_date \\\n",
"0 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"1 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"2 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"3 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"4 2021-12-14 12:57:08+00:00 Andrew Yang 2021-12-14 12:57:08+00:00 \n",
"... ... ... ... \n",
"43727 2017-07-23 14:16:51+00:00 Mario Carneiro 2017-07-23 14:16:51+00:00 \n",
"43728 2017-07-23 14:16:51+00:00 Mario Carneiro 2017-07-23 14:16:51+00:00 \n",
"43729 2017-07-23 14:16:51+00:00 Mario Carneiro 2017-07-23 14:16:51+00:00 \n",
"43730 2017-07-21 08:02:10+00:00 Leonardo de Moura 2017-07-21 08:02:10+00:00 \n",
"43731 2017-07-21 08:02:10+00:00 Leonardo de Moura 2017-07-21 08:02:10+00:00 \n",
"\n",
" hexsha num_parents \\\n",
"0 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"1 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"2 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"3 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"4 1367c19b1b5d53ec699e4003f7aaa40a8099a643 1 \n",
"... ... ... \n",
"43727 deb168147d4ede8848940a797753f026648501a4 1 \n",
"43728 deb168147d4ede8848940a797753f026648501a4 1 \n",
"43729 deb168147d4ede8848940a797753f026648501a4 1 \n",
"43730 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 0 \n",
"43731 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 0 \n",
"\n",
" commit \n",
"0 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 \n",
"1 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 \n",
"2 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 \n",
"3 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 \n",
"4 1367c19b1b5d53ec699e4003f7aaa40a8099a643 \n",
"... ... \n",
"43727 deb168147d4ede8848940a797753f026648501a4 \n",
"43728 deb168147d4ede8848940a797753f026648501a4 \n",
"43729 deb168147d4ede8848940a797753f026648501a4 \n",
"43730 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 \n",
"43731 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 \n",
"\n",
"[43732 rows x 14 columns]"
]
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"df = pd.DataFrame(data)\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 106,
"id": "388cb690-03e8-4af6-9ad2-43c49b151a5b",
"metadata": {},
"outputs": [],
"source": [
"df[\"ago\"] = pendulum.now(tz=\"utc\") - df[\"authored_date\"]"
]
},
{
"cell_type": "code",
"execution_count": 107,
"id": "4bb42872-629c-48e5-8ee2-4730f688579b",
"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>total_changed_files</th>\n",
" <th>file</th>\n",
" <th>area</th>\n",
" <th>file_insertions</th>\n",
" <th>file_deletions</th>\n",
" <th>file_total_changes</th>\n",
" <th>total_changes</th>\n",
" <th>author</th>\n",
" <th>authored_date</th>\n",
" <th>committer</th>\n",
" <th>committed_date</th>\n",
" <th>hexsha</th>\n",
" <th>num_parents</th>\n",
" <th>commit</th>\n",
" <th>ago</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/function/lp_space.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>13</td>\n",
" <td>0</td>\n",
" <td>13</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>0 days 09:16:59.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/integral/bochner.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>0 days 09:16:59.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/integral/set_to_l1.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>601</td>\n",
" <td>13</td>\n",
" <td>614</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>0 days 09:16:59.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>5</td>\n",
" <td>src/measure_theory/measure/measure_space.lean</td>\n",
" <td>measure_theory</td>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>4</td>\n",
" <td>644</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>Rémy Degenne</td>\n",
" <td>2021-12-14 14:14:24+00:00</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>1</td>\n",
" <td>e3eb0eb024dd2c436c94d3e7386c70f50c5f1261</td>\n",
" <td>0 days 09:16:59.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>src/algebraic_geometry/locally_ringed_space/ha...</td>\n",
" <td>algebraic_geometry</td>\n",
" <td>111</td>\n",
" <td>0</td>\n",
" <td>111</td>\n",
" <td>224</td>\n",
" <td>Andrew Yang</td>\n",
" <td>2021-12-14 12:57:08+00:00</td>\n",
" <td>Andrew Yang</td>\n",
" <td>2021-12-14 12:57:08+00:00</td>\n",
" <td>1367c19b1b5d53ec699e4003f7aaa40a8099a643</td>\n",
" <td>1</td>\n",
" <td>1367c19b1b5d53ec699e4003f7aaa40a8099a643</td>\n",
" <td>0 days 10:34:15.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43727</th>\n",
" <td>71</td>\n",
" <td>topology/continuity.lean</td>\n",
" <td>continuity.lean</td>\n",
" <td>331</td>\n",
" <td>0</td>\n",
" <td>331</td>\n",
" <td>22461</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1605 days 09:14:32.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43728</th>\n",
" <td>71</td>\n",
" <td>topology/topological_space.lean</td>\n",
" <td>topological_space.lean</td>\n",
" <td>622</td>\n",
" <td>0</td>\n",
" <td>622</td>\n",
" <td>22461</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1605 days 09:14:32.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43729</th>\n",
" <td>71</td>\n",
" <td>topology/uniform_space.lean</td>\n",
" <td>uniform_space.lean</td>\n",
" <td>1127</td>\n",
" <td>0</td>\n",
" <td>1127</td>\n",
" <td>22461</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>Mario Carneiro</td>\n",
" <td>2017-07-23 14:16:51+00:00</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1</td>\n",
" <td>deb168147d4ede8848940a797753f026648501a4</td>\n",
" <td>1605 days 09:14:32.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43730</th>\n",
" <td>2</td>\n",
" <td>LICENSE</td>\n",
" <td>None</td>\n",
" <td>201</td>\n",
" <td>0</td>\n",
" <td>201</td>\n",
" <td>203</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" <td>0</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" <td>1607 days 15:29:13.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43731</th>\n",
" <td>2</td>\n",
" <td>README.md</td>\n",
" <td>None</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>203</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>Leonardo de Moura</td>\n",
" <td>2017-07-21 08:02:10+00:00</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" <td>0</td>\n",
" <td>21aca921c66c5ba975a221b453d0c9fc6dfe9c80</td>\n",
" <td>1607 days 15:29:13.710199</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>43732 rows × 15 columns</p>\n",
"</div>"
],
"text/plain": [
" total_changed_files file \\\n",
"0 5 src/measure_theory/function/lp_space.lean \n",
"1 5 src/measure_theory/integral/bochner.lean \n",
"2 5 src/measure_theory/integral/set_to_l1.lean \n",
"3 5 src/measure_theory/measure/measure_space.lean \n",
"4 5 src/algebraic_geometry/locally_ringed_space/ha... \n",
"... ... ... \n",
"43727 71 topology/continuity.lean \n",
"43728 71 topology/topological_space.lean \n",
"43729 71 topology/uniform_space.lean \n",
"43730 2 LICENSE \n",
"43731 2 README.md \n",
"\n",
" area file_insertions file_deletions \\\n",
"0 measure_theory 13 0 \n",
"1 measure_theory 1 1 \n",
"2 measure_theory 601 13 \n",
"3 measure_theory 4 0 \n",
"4 algebraic_geometry 111 0 \n",
"... ... ... ... \n",
"43727 continuity.lean 331 0 \n",
"43728 topological_space.lean 622 0 \n",
"43729 uniform_space.lean 1127 0 \n",
"43730 None 201 0 \n",
"43731 None 2 0 \n",
"\n",
" file_total_changes total_changes author \\\n",
"0 13 644 Rémy Degenne \n",
"1 2 644 Rémy Degenne \n",
"2 614 644 Rémy Degenne \n",
"3 4 644 Rémy Degenne \n",
"4 111 224 Andrew Yang \n",
"... ... ... ... \n",
"43727 331 22461 Mario Carneiro \n",
"43728 622 22461 Mario Carneiro \n",
"43729 1127 22461 Mario Carneiro \n",
"43730 201 203 Leonardo de Moura \n",
"43731 2 203 Leonardo de Moura \n",
"\n",
" authored_date committer committed_date \\\n",
"0 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"1 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"2 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"3 2021-12-14 14:14:24+00:00 Rémy Degenne 2021-12-14 14:14:24+00:00 \n",
"4 2021-12-14 12:57:08+00:00 Andrew Yang 2021-12-14 12:57:08+00:00 \n",
"... ... ... ... \n",
"43727 2017-07-23 14:16:51+00:00 Mario Carneiro 2017-07-23 14:16:51+00:00 \n",
"43728 2017-07-23 14:16:51+00:00 Mario Carneiro 2017-07-23 14:16:51+00:00 \n",
"43729 2017-07-23 14:16:51+00:00 Mario Carneiro 2017-07-23 14:16:51+00:00 \n",
"43730 2017-07-21 08:02:10+00:00 Leonardo de Moura 2017-07-21 08:02:10+00:00 \n",
"43731 2017-07-21 08:02:10+00:00 Leonardo de Moura 2017-07-21 08:02:10+00:00 \n",
"\n",
" hexsha num_parents \\\n",
"0 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"1 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"2 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"3 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1 \n",
"4 1367c19b1b5d53ec699e4003f7aaa40a8099a643 1 \n",
"... ... ... \n",
"43727 deb168147d4ede8848940a797753f026648501a4 1 \n",
"43728 deb168147d4ede8848940a797753f026648501a4 1 \n",
"43729 deb168147d4ede8848940a797753f026648501a4 1 \n",
"43730 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 0 \n",
"43731 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 0 \n",
"\n",
" commit ago \n",
"0 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 0 days 09:16:59.710199 \n",
"1 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 0 days 09:16:59.710199 \n",
"2 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 0 days 09:16:59.710199 \n",
"3 e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 0 days 09:16:59.710199 \n",
"4 1367c19b1b5d53ec699e4003f7aaa40a8099a643 0 days 10:34:15.710199 \n",
"... ... ... \n",
"43727 deb168147d4ede8848940a797753f026648501a4 1605 days 09:14:32.710199 \n",
"43728 deb168147d4ede8848940a797753f026648501a4 1605 days 09:14:32.710199 \n",
"43729 deb168147d4ede8848940a797753f026648501a4 1605 days 09:14:32.710199 \n",
"43730 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 1607 days 15:29:13.710199 \n",
"43731 21aca921c66c5ba975a221b453d0c9fc6dfe9c80 1607 days 15:29:13.710199 \n",
"\n",
"[43732 rows x 15 columns]"
]
},
"execution_count": 107,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 113,
"id": "9e1f5468-2229-4cb6-90f6-d48b193df749",
"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>total_changed_files</th>\n",
" <th>file_insertions</th>\n",
" <th>file_deletions</th>\n",
" <th>file_total_changes</th>\n",
" <th>total_changes</th>\n",
" <th>num_parents</th>\n",
" <th>ago</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>43732.000000</td>\n",
" <td>43732.000000</td>\n",
" <td>43732.000000</td>\n",
" <td>43732.000000</td>\n",
" <td>43732.000000</td>\n",
" <td>43732.000000</td>\n",
" <td>43732</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>38.258804</td>\n",
" <td>27.504756</td>\n",
" <td>10.614836</td>\n",
" <td>38.119592</td>\n",
" <td>579.965449</td>\n",
" <td>1.004345</td>\n",
" <td>500 days 13:37:23.744864696</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>80.283505</td>\n",
" <td>82.223446</td>\n",
" <td>55.946024</td>\n",
" <td>110.114524</td>\n",
" <td>1267.844387</td>\n",
" <td>0.066463</td>\n",
" <td>391 days 13:21:03.408478532</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>1.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0 days 09:16:59.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>3.000000</td>\n",
" <td>1.000000</td>\n",
" <td>0.000000</td>\n",
" <td>3.000000</td>\n",
" <td>68.000000</td>\n",
" <td>1.000000</td>\n",
" <td>195 days 12:58:19.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>9.000000</td>\n",
" <td>5.000000</td>\n",
" <td>1.000000</td>\n",
" <td>8.000000</td>\n",
" <td>222.000000</td>\n",
" <td>1.000000</td>\n",
" <td>439 days 20:34:18.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>30.000000</td>\n",
" <td>18.000000</td>\n",
" <td>5.000000</td>\n",
" <td>28.000000</td>\n",
" <td>667.000000</td>\n",
" <td>1.000000</td>\n",
" <td>658 days 07:24:33.710199</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>453.000000</td>\n",
" <td>4084.000000</td>\n",
" <td>3429.000000</td>\n",
" <td>7292.000000</td>\n",
" <td>22461.000000</td>\n",
" <td>2.000000</td>\n",
" <td>1607 days 15:29:13.710199</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" total_changed_files file_insertions file_deletions \\\n",
"count 43732.000000 43732.000000 43732.000000 \n",
"mean 38.258804 27.504756 10.614836 \n",
"std 80.283505 82.223446 55.946024 \n",
"min 1.000000 0.000000 0.000000 \n",
"25% 3.000000 1.000000 0.000000 \n",
"50% 9.000000 5.000000 1.000000 \n",
"75% 30.000000 18.000000 5.000000 \n",
"max 453.000000 4084.000000 3429.000000 \n",
"\n",
" file_total_changes total_changes num_parents \\\n",
"count 43732.000000 43732.000000 43732.000000 \n",
"mean 38.119592 579.965449 1.004345 \n",
"std 110.114524 1267.844387 0.066463 \n",
"min 0.000000 0.000000 0.000000 \n",
"25% 3.000000 68.000000 1.000000 \n",
"50% 8.000000 222.000000 1.000000 \n",
"75% 28.000000 667.000000 1.000000 \n",
"max 7292.000000 22461.000000 2.000000 \n",
"\n",
" ago \n",
"count 43732 \n",
"mean 500 days 13:37:23.744864696 \n",
"std 391 days 13:21:03.408478532 \n",
"min 0 days 09:16:59.710199 \n",
"25% 195 days 12:58:19.710199 \n",
"50% 439 days 20:34:18.710199 \n",
"75% 658 days 07:24:33.710199 \n",
"max 1607 days 15:29:13.710199 "
]
},
"execution_count": 113,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.describe()"
]
},
{
"cell_type": "code",
"execution_count": 151,
"id": "9cd66861-6f47-47bc-89ae-1429ab1fe565",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"RollingGroupby [window=2592000000000000,min_periods=1,center=False,win_type=freq,axis=0,on=authored_date]"
]
},
"execution_count": 151,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2 = df.set_index(\"hexsha\")\n",
"df2.groupby(\"hexsha\").rolling(\"30d\", on=\"authored_date\")"
]
},
{
"cell_type": "code",
"execution_count": 126,
"id": "f07f54ea-4542-433f-a2be-981026b074d0",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/homebrew/anaconda3/lib/python3.8/site-packages/pandas/core/window/rolling.py:2010: FutureWarning: min_periods=None will default to the size of window consistent with other methods in a future version. Specify min_periods=0 instead.\n",
" warnings.warn(\n"
]
},
{
"data": {
"text/plain": [
"hexsha\n",
"e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 1.0\n",
"e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 2.0\n",
"e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 3.0\n",
"e3eb0eb024dd2c436c94d3e7386c70f50c5f1261 4.0\n",
"1367c19b1b5d53ec699e4003f7aaa40a8099a643 5.0\n",
" ... \n",
"deb168147d4ede8848940a797753f026648501a4 30.0\n",
"deb168147d4ede8848940a797753f026648501a4 30.0\n",
"deb168147d4ede8848940a797753f026648501a4 30.0\n",
"21aca921c66c5ba975a221b453d0c9fc6dfe9c80 30.0\n",
"21aca921c66c5ba975a221b453d0c9fc6dfe9c80 30.0\n",
"Name: author, Length: 43732, dtype: float64"
]
},
"execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2.rolling(30, on=\"authored_date\")[\"author\"].count()"
]
},
{
"cell_type": "code",
"execution_count": 129,
"id": "72f44d82-315d-48e2-8150-72f6765f1f48",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "unstack() got an unexpected keyword argument 'axis'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/var/folders/4p/mgyph8ds28sgxk21xrn2f5r80000gn/T/ipykernel_55164/2825815962.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munstack\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m: unstack() got an unexpected keyword argument 'axis'"
]
}
],
"source": [
"df2.unstack(axis=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bd782b4f-c923-476f-885e-095f0b7e64d2",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment