adding summary column
This commit is contained in:
@@ -250,6 +250,48 @@
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "3276cce7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def summarize(row):\n",
|
||||
" ADRs = row['DOSES_SHIPPED'] / row['OVERALL_DOSES_SHIPPED'] * row['Adverse Reaction Reports']\n",
|
||||
" return f\"{row['DOSES_SHIPPED']} (out of {row['OVERALL_DOSES_SHIPPED']}) shipped doses are statistically responsible for <b>{ADRs:.2f}</b> (out of {row['Adverse Reaction Reports']}) adverse reaction reports\"\n",
|
||||
"\n",
|
||||
"vaccineDistributionByZipcode['Summary'] = vaccineDistributionByZipcode.apply(summarize, axis = 'columns')\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "10cf731f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vaccineDistributionByZipcode = vaccineDistributionByZipcode[['PROVIDER_NAME', 'ZIPCODE_SHP', 'LOT_NUMBER', 'Summary']]\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "0c2020e9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vaccineDistributionByZipcode = vaccineDistributionByZipcode.rename(\n",
|
||||
" columns = {\n",
|
||||
" 'PROVIDER_NAME': 'Provider',\n",
|
||||
" 'ZIPCODE_SHP': 'ZIP Code',\n",
|
||||
" 'LOT_NUMBER': 'Lot Number'\n",
|
||||
" })\n",
|
||||
"vaccineDistributionByZipcode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -257,7 +299,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vaccineDistributionByZipcode.to_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_sumDoses.xlsx')"
|
||||
"# vaccineDistributionByZipcode.to_excel('tmp/Amended-22-01962-Pfizer-2022-0426-pulled-2022-0823_sumDoses.xlsx')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user