X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/72a71a545ddfbb9250308146efdda18f8ebcdfc1..ea3abfdad5df78e020429d07e6e476b1cb1317e8:/data/issues.ipynb diff --git a/data/issues.ipynb b/data/issues.ipynb index 6c081fe..7b7f1be 100644 --- a/data/issues.ipynb +++ b/data/issues.ipynb @@ -7,9 +7,21 @@ "outputs": [], "source": [ "import platform\n", + "import matplotlib.pyplot as plt\n", "print(platform.python_version())" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Todo List\n", + "\n", + "- [ ] trim each chart to just a single, selected year\n", + "- [ ] make one chart per year\n", + "- [x] make sure all the data files are getting loaded" + ] + }, { "cell_type": "code", "execution_count": null, @@ -43,14 +55,14 @@ "source": [ "import pandas as pd\n", "\n", - "data_sets = []\n", + "data_frames = []\n", + "for file in data_files:\n", "\n", - "# file = data_files[6] # CLI Tools\n", - "file = data_files[2] # Job Aids\n", - "print(file)\n", + "\tf = open(file, encoding='utf-8')\n", + "\tdf_temp = pd.read_json(f)\n", + "\tdata_frames.append(df_temp)\n", "\n", - "f = open(file, encoding='utf-8')\n", - "df = pd.read_json(f)" + "df = pd.concat(data_frames, ignore_index=True)" ] }, { @@ -79,7 +91,12 @@ "source": [ "dfp = df\n", "dfp['mile'] = [d.get('title') if d else None for d in dfp.milestone]\n", - "dfp.drop(columns=['closedAt','milestone', 'url'], inplace=True)" + "closed_dates = pd.to_datetime(df['closedAt'], format='ISO8601')\n", + "dfp['year'] = closed_dates.dt.year\n", + "\n", + "# TODO: Split by YEAR before dropping 'closedAt'\n", + "dfp.drop(columns=['closedAt','milestone', 'url'], inplace=True)\n", + "print(dfp)" ] }, { @@ -106,12 +123,33 @@ "source": [ "mile_counts = df.groupby('mile')['count'].sum()\n", "mile_counts = mile_counts.loc[lambda x: x > 5]\n", - "plt.pie(mile_counts, labels=mile_counts.index, autopct='%1.1f%%')\n", + "\n", + "\n", + "print(mile_counts)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "plt.pie(mile_counts, labels=mile_counts.index, autopct='%0.1f%%')\n", "plt.title(f\"Tasks by Milestone\")\n", "plt.axis('equal')\n", "plt.show()" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "type(mile_counts)" + ] + }, { "cell_type": "markdown", "metadata": {},