replacing column "Summary" with columns "Doses Shipped", "Statistical Number of Adverse Reaction Reports" and "Statistical Number of Adverse Reaction Reports (per 100,000)"

This commit is contained in:
frankknoll
2023-03-13 02:22:02 +01:00
parent 50a42f9311
commit 253e7ff425
4 changed files with 14 additions and 15 deletions

View File

@@ -257,11 +257,8 @@
"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['Statistical Number of Adverse Reaction Reports'] = (vaccineDistributionByZipcode['DOSES_SHIPPED'] / vaccineDistributionByZipcode['OVERALL_DOSES_SHIPPED'] * vaccineDistributionByZipcode['Adverse Reaction Reports']).round(2)\n",
"vaccineDistributionByZipcode['Statistical Number of Adverse Reaction Reports (per 100,000)'] = (vaccineDistributionByZipcode['DOSES_SHIPPED'] / vaccineDistributionByZipcode['OVERALL_DOSES_SHIPPED'] * 100000).round().astype(int)\n",
"vaccineDistributionByZipcode"
]
},
@@ -272,7 +269,7 @@
"metadata": {},
"outputs": [],
"source": [
"vaccineDistributionByZipcode = vaccineDistributionByZipcode[['PROVIDER_NAME', 'ZIPCODE_SHP', 'LOT_NUMBER', 'Summary']]\n",
"vaccineDistributionByZipcode = vaccineDistributionByZipcode[['PROVIDER_NAME', 'ZIPCODE_SHP', 'LOT_NUMBER', 'DOSES_SHIPPED', 'Statistical Number of Adverse Reaction Reports', 'Statistical Number of Adverse Reaction Reports (per 100,000)']]\n",
"vaccineDistributionByZipcode"
]
},
@@ -287,7 +284,8 @@
" columns = {\n",
" 'PROVIDER_NAME': 'Provider',\n",
" 'ZIPCODE_SHP': 'ZIP Code',\n",
" 'LOT_NUMBER': 'Lot Number'\n",
" 'LOT_NUMBER': 'Lot Number',\n",
" 'DOSES_SHIPPED': 'Doses Shipped'\n",
" })\n",
"vaccineDistributionByZipcode"
]