showing outputs in notebook

This commit is contained in:
frankknoll
2022-01-27 13:57:14 +01:00
parent ba1b809b1c
commit a4d57729b3

View File

@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 9,
"id": "9de5907f-18f5-4cb1-903e-26028ff1fa03", "id": "9de5907f-18f5-4cb1-903e-26028ff1fa03",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -16,7 +16,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 10,
"id": "233bc590", "id": "233bc590",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -39,7 +39,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 11,
"id": "99945ca8", "id": "99945ca8",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -59,21 +59,489 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 12,
"id": "86e0e4f2", "id": "86e0e4f2",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"def saveBatchCodeTable(manufacturer, excelFile):\n", "def saveBatchCodeTable(manufacturer, excelFile):\n",
" createBatchCodeTable(createDataFrame(\"VAERS\", manufacturer)).to_excel(excelFile)\n" " batchCodeTable = createBatchCodeTable(createDataFrame(\"VAERS\", manufacturer))\n",
" display(manufacturer, batchCodeTable)\n",
" batchCodeTable.to_excel(excelFile)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 13,
"id": "ab170c16", "id": "ab170c16",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"data": {
"text/plain": [
"'MODERNA'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"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>ADRs</th>\n",
" <th>DEATHS</th>\n",
" <th>DISABILITIES</th>\n",
" <th>LIFE THREATENING ILLNESSES</th>\n",
" </tr>\n",
" <tr>\n",
" <th>VAX_LOT</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>026L20A</th>\n",
" <td>4177</td>\n",
" <td>42.0</td>\n",
" <td>35.0</td>\n",
" <td>28.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>039K20A</th>\n",
" <td>4169</td>\n",
" <td>93.0</td>\n",
" <td>39.0</td>\n",
" <td>37.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>011J20A</th>\n",
" <td>3661</td>\n",
" <td>37.0</td>\n",
" <td>33.0</td>\n",
" <td>28.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>013L20A</th>\n",
" <td>3191</td>\n",
" <td>68.0</td>\n",
" <td>47.0</td>\n",
" <td>32.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>012L20A</th>\n",
" <td>3068</td>\n",
" <td>72.0</td>\n",
" <td>30.0</td>\n",
" <td>30.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>029L2VA</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>029L2oa</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>029L30A</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>029L420A</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ø38B21A</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>16284 rows × 4 columns</p>\n",
"</div>"
],
"text/plain": [
" ADRs DEATHS DISABILITIES LIFE THREATENING ILLNESSES\n",
"VAX_LOT \n",
"026L20A 4177 42.0 35.0 28.0\n",
"039K20A 4169 93.0 39.0 37.0\n",
"011J20A 3661 37.0 33.0 28.0\n",
"013L20A 3191 68.0 47.0 32.0\n",
"012L20A 3068 72.0 30.0 30.0\n",
"... ... ... ... ...\n",
"029L2VA 1 0.0 0.0 0.0\n",
"029L2oa 1 0.0 0.0 0.0\n",
"029L30A 1 0.0 0.0 0.0\n",
"029L420A 1 0.0 0.0 0.0\n",
"Ø38B21A 1 0.0 0.0 0.0\n",
"\n",
"[16284 rows x 4 columns]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/frankknoll/.local/lib/python3.9/site-packages/pandas/compat/_optional.py:149: UserWarning: Pandas requires version '1.2.2' or newer of 'xlsxwriter' (version '1.1.2' currently installed).\n",
" warnings.warn(msg, UserWarning)\n"
]
},
{
"data": {
"text/plain": [
"'PFIZER\\\\BIONTECH'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"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>ADRs</th>\n",
" <th>DEATHS</th>\n",
" <th>DISABILITIES</th>\n",
" <th>LIFE THREATENING ILLNESSES</th>\n",
" </tr>\n",
" <tr>\n",
" <th>VAX_LOT</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>EK9231</th>\n",
" <td>3392</td>\n",
" <td>48.0</td>\n",
" <td>56.0</td>\n",
" <td>35.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ER2613</th>\n",
" <td>3345</td>\n",
" <td>65.0</td>\n",
" <td>62.0</td>\n",
" <td>57.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>EN6201</th>\n",
" <td>2928</td>\n",
" <td>148.0</td>\n",
" <td>69.0</td>\n",
" <td>55.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>EN5318</th>\n",
" <td>2811</td>\n",
" <td>114.0</td>\n",
" <td>62.0</td>\n",
" <td>57.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ER8732</th>\n",
" <td>2705</td>\n",
" <td>50.0</td>\n",
" <td>51.0</td>\n",
" <td>68.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>EN6203 UPC</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>EN6203,</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>EN6203, EL3247</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>EN6203, EN6204</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ÉÑ6198</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>12447 rows × 4 columns</p>\n",
"</div>"
],
"text/plain": [
" ADRs DEATHS DISABILITIES LIFE THREATENING ILLNESSES\n",
"VAX_LOT \n",
"EK9231 3392 48.0 56.0 35.0\n",
"ER2613 3345 65.0 62.0 57.0\n",
"EN6201 2928 148.0 69.0 55.0\n",
"EN5318 2811 114.0 62.0 57.0\n",
"ER8732 2705 50.0 51.0 68.0\n",
"... ... ... ... ...\n",
"EN6203 UPC 1 0.0 0.0 0.0\n",
"EN6203, 1 0.0 0.0 0.0\n",
"EN6203, EL3247 1 0.0 0.0 0.0\n",
"EN6203, EN6204 1 0.0 0.0 0.0\n",
"ÉÑ6198 1 0.0 0.0 0.0\n",
"\n",
"[12447 rows x 4 columns]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/frankknoll/.local/lib/python3.9/site-packages/pandas/compat/_optional.py:149: UserWarning: Pandas requires version '1.2.2' or newer of 'xlsxwriter' (version '1.1.2' currently installed).\n",
" warnings.warn(msg, UserWarning)\n"
]
},
{
"data": {
"text/plain": [
"'JANSSEN'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"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>ADRs</th>\n",
" <th>DEATHS</th>\n",
" <th>DISABILITIES</th>\n",
" <th>LIFE THREATENING ILLNESSES</th>\n",
" </tr>\n",
" <tr>\n",
" <th>VAX_LOT</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Unknown</th>\n",
" <td>7312</td>\n",
" <td>264.0</td>\n",
" <td>19.0</td>\n",
" <td>31.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>043A21A</th>\n",
" <td>2347</td>\n",
" <td>37.0</td>\n",
" <td>31.0</td>\n",
" <td>49.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>042A21A</th>\n",
" <td>2170</td>\n",
" <td>44.0</td>\n",
" <td>41.0</td>\n",
" <td>43.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1805018</th>\n",
" <td>1756</td>\n",
" <td>35.0</td>\n",
" <td>36.0</td>\n",
" <td>49.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>202A21A</th>\n",
" <td>1726</td>\n",
" <td>25.0</td>\n",
" <td>21.0</td>\n",
" <td>25.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>180E018</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>180D068</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>180C068</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>180B982</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>zz</th>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>2456 rows × 4 columns</p>\n",
"</div>"
],
"text/plain": [
" ADRs DEATHS DISABILITIES LIFE THREATENING ILLNESSES\n",
"VAX_LOT \n",
"Unknown 7312 264.0 19.0 31.0\n",
"043A21A 2347 37.0 31.0 49.0\n",
"042A21A 2170 44.0 41.0 43.0\n",
"1805018 1756 35.0 36.0 49.0\n",
"202A21A 1726 25.0 21.0 25.0\n",
"... ... ... ... ...\n",
"180E018 1 0.0 0.0 0.0\n",
"180D068 1 0.0 0.0 0.0\n",
"180C068 1 0.0 0.0 0.0\n",
"180B982 1 0.0 0.0 0.0\n",
"zz 1 0.0 0.0 0.0\n",
"\n",
"[2456 rows x 4 columns]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/frankknoll/.local/lib/python3.9/site-packages/pandas/compat/_optional.py:149: UserWarning: Pandas requires version '1.2.2' or newer of 'xlsxwriter' (version '1.1.2' currently installed).\n",
" warnings.warn(msg, UserWarning)\n"
]
}
],
"source": [ "source": [
"saveBatchCodeTable(\"MODERNA\", \"results/moderna.xlsx\")\n", "saveBatchCodeTable(\"MODERNA\", \"results/moderna.xlsx\")\n",
"saveBatchCodeTable(\"PFIZER\\BIONTECH\", \"results/pfizer.xlsx\")\n", "saveBatchCodeTable(\"PFIZER\\BIONTECH\", \"results/pfizer.xlsx\")\n",
@@ -82,7 +550,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 14,
"id": "9f506ac8", "id": "9f506ac8",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -92,7 +560,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 15,
"id": "e14465d7", "id": "e14465d7",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -126,10 +594,274 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 16,
"id": "ef8f99c4", "id": "ef8f99c4",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"test_createBatchCodeTable (__main__.HowBadIsMyBatchTest) ... "
]
},
{
"data": {
"text/plain": [
"'dataFrame:'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"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>DIED</th>\n",
" <th>L_THREAT</th>\n",
" <th>DISABLE</th>\n",
" <th>VAX_TYPE</th>\n",
" <th>VAX_MANU</th>\n",
" <th>VAX_LOT</th>\n",
" </tr>\n",
" <tr>\n",
" <th>VAERS_ID</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>916600</th>\n",
" <td>Y</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>COVID19</td>\n",
" <td>MODERNA</td>\n",
" <td>037K20A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>916601</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Y</td>\n",
" <td>COVID19</td>\n",
" <td>MODERNA</td>\n",
" <td>025L20A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1996874</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Y</td>\n",
" <td>COVID19</td>\n",
" <td>MODERNA</td>\n",
" <td>025L20A</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" DIED L_THREAT DISABLE VAX_TYPE VAX_MANU VAX_LOT\n",
"VAERS_ID \n",
"916600 Y NaN NaN COVID19 MODERNA 037K20A\n",
"916601 NaN NaN Y COVID19 MODERNA 025L20A\n",
"1996874 NaN NaN Y COVID19 MODERNA 025L20A"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"'batchCodeTable:'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"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>ADRs</th>\n",
" <th>DEATHS</th>\n",
" <th>DISABILITIES</th>\n",
" <th>LIFE THREATENING ILLNESSES</th>\n",
" </tr>\n",
" <tr>\n",
" <th>VAX_LOT</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>025L20A</th>\n",
" <td>2</td>\n",
" <td>0.0</td>\n",
" <td>2.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>037K20A</th>\n",
" <td>1</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" ADRs DEATHS DISABILITIES LIFE THREATENING ILLNESSES\n",
"VAX_LOT \n",
"025L20A 2 0.0 2.0 0.0\n",
"037K20A 1 1.0 0.0 0.0"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"'batchCodeTableExpected:'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"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>ADRs</th>\n",
" <th>DEATHS</th>\n",
" <th>DISABILITIES</th>\n",
" <th>LIFE THREATENING ILLNESSES</th>\n",
" </tr>\n",
" <tr>\n",
" <th>VAX_LOT</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>025L20A</th>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>037K20A</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" ADRs DEATHS DISABILITIES LIFE THREATENING ILLNESSES\n",
"VAX_LOT \n",
"025L20A 2 0 2 0\n",
"037K20A 1 1 0 0"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ok\n",
"\n",
"----------------------------------------------------------------------\n",
"Ran 1 test in 0.180s\n",
"\n",
"OK\n"
]
},
{
"data": {
"text/plain": [
"<unittest.main.TestProgram at 0x7fb670669c10>"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"unittest.main(argv = [''], verbosity = 2, exit = False)" "unittest.main(argv = [''], verbosity = 2, exit = False)"
] ]