]> apps.delaporte.us Git - dotfiles.git/blobdiff - data/issues.ipynb
Cleanup unused code
[dotfiles.git] / data / issues.ipynb
index 2156a71641d394dd000abcfcfbb8dd15604f0a90..3340aaf7fa1346863cb8dd42e539c3eb0c4719e5 100644 (file)
@@ -2,7 +2,25 @@
  "cells": [
   {
    "cell_type": "code",
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 21,
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "3.12.2\n"
+     ]
+    }
+   ],
+   "source": [
+    "import platform\n",
+    "print(platform.python_version())"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 92,
    "metadata": {},
    "outputs": [],
    "source": [
    "metadata": {},
    "outputs": [],
    "source": [
     "import glob\n",
     "import os\n",
     "\n",
     "import glob\n",
     "import os\n",
     "\n",
-    "data_files = glob.glob(os.path.expanduser('~\\\\Data\\\\*.json'))"
+    "data_files = glob.glob(os.path.expanduser('~\\\\Data\\\\*.json'))\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import os\n",
+    "\n",
+    "for file in data_files:\n",
+    "\tprint(f\"{file}\", os.path.getsize(file))\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import pandas as pd\n",
+    "\n",
+    "data_sets = []\n",
+    "\n",
+    "file = data_files[6]\n",
+    "print(file)\n",
+    "\n",
+    "f = open(file, encoding='utf-8')\n",
+    "df = pd.read_json(f)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 94,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import numpy as np\n",
+    "df['count'] = np.zeros(len(df))\n",
+    "\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 95,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "closed_months = pd.to_datetime(df['closedAt'], format='ISO8601')\n",
+    "df['closed_month'] = closed_months.dt.month"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 97,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "df['mile'] = [d.get('title') if d else None for d in df.milestone]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 98,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "\n",
+    "grp_df = df.groupby(['mile', 'closed_month']).count().reset_index()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "print(grp_df)"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "#### Plot of closed issues by month and milestone for one project\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 99,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import seaborn as sns\n",
+    "import matplotlib.pyplot as plt\n",
+    "sns.set_theme()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "plt.figure(figsize=(10, 6))\n",
+    "sns.lineplot(x='closed_month', y='url', hue='mile', data=grp_df, marker='o', ci=None)\n",
+    "plt.xlabel('Closed Month')\n",
+    "plt.ylabel('ClosedAt')\n",
+    "plt.title('Stacked Line Chart: Milestone Effort by Issue Close Date')\n",
+    "plt.xticks(rotation=45)\n",
+    "plt.legend(title='Mile', loc='upper left')\n",
+    "plt.show()"
    ]
   }
  ],
    ]
   }
  ],
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.12.1"
+   "version": "3.12.2"
   }
  },
  "nbformat": 4,
   }
  },
  "nbformat": 4,