X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/blobdiff_plain/ac202236f525135adec8fa272fcf919ed0b871f8..39aa091f5951f7dde7ae65831749d9c5d03b8b51:/data/issues.ipynb diff --git a/data/issues.ipynb b/data/issues.ipynb index 735326e..011beec 100644 --- a/data/issues.ipynb +++ b/data/issues.ipynb @@ -2,7 +2,17 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import platform\n", + "print(platform.python_version())" + ] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -25,24 +35,6 @@ "\tprint(f\"{file}\", os.path.getsize(file))\n" ] }, - { - "cell_type": "code", - "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": null, @@ -53,30 +45,13 @@ "\n", "data_sets = []\n", "\n", - "file = data_files[6]\n", + "file = data_files[2]\n", "print(file)\n", "\n", - "f = open(file, encoding='utf-16')\n", + "f = open(file, encoding='utf-8')\n", "df = pd.read_json(f)" ] }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], - "source": [ - "print(type(df.closed[0]))" - ] - }, { "cell_type": "code", "execution_count": null, @@ -93,23 +68,15 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "print(df.milestone[22].get('title'))" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "metadata": {}, - "outputs": [], "source": [ "closed_months = pd.to_datetime(df['closedAt'], format='ISO8601')\n", - "df['closed_month'] = closed_months.dt.month" + "df['closed_month'] = closed_months.dt.month\n", + "df.drop(columns=['closedAt'], inplace=True)" ] }, { "cell_type": "code", - "execution_count": 69, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -118,21 +85,13 @@ }, { "cell_type": "code", - "execution_count": 39, - "metadata": {}, - "outputs": [], - "source": [ - "for_plot = df.groupby(df.closed.dt.month)['url'].count()" - ] - }, - { - "cell_type": "code", - "execution_count": 70, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", - "grp_df = df.groupby(['mile', 'closed_month']).count().reset_index()" + "dfg = df.groupby(['mile', 'closed_month']).count().reset_index()\n", + "dfg.drop(columns=['milestone', 'title', 'url'], inplace=True)\n" ] }, { @@ -141,28 +100,33 @@ "metadata": {}, "outputs": [], "source": [ - "print(grp_df)" + "\n", + "print(dfg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "#### Plot of closed issues by month for one project\n" + "#### Plot of closed issues by month and milestone for one project\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ - "for_plot.plot(kind='bar')" + "exclude_from_chart = [\n", + "\t'Job Aid Ideas']\n", + "\n", + "for ex in exclude_from_chart:\n", + "\tdfg = dfg[dfg['mile'] != ex]\n" ] }, { "cell_type": "code", - "execution_count": 75, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -178,7 +142,7 @@ "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", + "sns.barplot(x='closed_month', y='count', hue='mile', data=dfg)\n", "plt.xlabel('Closed Month')\n", "plt.ylabel('ClosedAt')\n", "plt.title('Stacked Line Chart: Milestone Effort by Issue Close Date')\n",