renaming columns
This commit is contained in:
@@ -202,13 +202,13 @@
|
|||||||
" summationTable = SummationTableFactory.createSummationTable(\n",
|
" summationTable = SummationTableFactory.createSummationTable(\n",
|
||||||
" dataFrame,\n",
|
" dataFrame,\n",
|
||||||
" columnNameMappingsDict = {\n",
|
" columnNameMappingsDict = {\n",
|
||||||
" \"DIED_size\": \"Total reports\",\n",
|
" \"DIED_size\": \"Total Number of Adverse Reaction Reports\",\n",
|
||||||
" \"DIED_sum\": \"Deaths\",\n",
|
" \"DIED_sum\": \"Deaths\",\n",
|
||||||
" \"L_THREAT_sum\": \"Life Threatening Illnesses\",\n",
|
" \"L_THREAT_sum\": \"Life Threatening Illnesses\",\n",
|
||||||
" \"DISABLE_sum\": \"Disabilities\"\n",
|
" \"DISABLE_sum\": \"Disabilities\"\n",
|
||||||
" })\n",
|
" })\n",
|
||||||
" summationTable['Severe reports (%)'] = (summationTable['Deaths'] + summationTable['Disabilities'] + summationTable['Life Threatening Illnesses']) / summationTable['Total reports'] * 100\n",
|
" summationTable['Severe reports (%)'] = (summationTable['Deaths'] + summationTable['Disabilities'] + summationTable['Life Threatening Illnesses']) / summationTable['Total Number of Adverse Reaction Reports'] * 100\n",
|
||||||
" summationTable = summationTable[['Total reports', 'Deaths', 'Disabilities', 'Life Threatening Illnesses', 'Severe reports (%)']]\n",
|
" summationTable = summationTable[['Total Number of Adverse Reaction Reports', 'Deaths', 'Disabilities', 'Life Threatening Illnesses', 'Severe reports (%)']]\n",
|
||||||
" return summationTable\n",
|
" return summationTable\n",
|
||||||
"\n",
|
"\n",
|
||||||
" @staticmethod\n",
|
" @staticmethod\n",
|
||||||
@@ -797,7 +797,7 @@
|
|||||||
" doseTable,\n",
|
" doseTable,\n",
|
||||||
" pd.DataFrame(\n",
|
" pd.DataFrame(\n",
|
||||||
" data = {\n",
|
" data = {\n",
|
||||||
" 'Total reports': [2, 1],\n",
|
" 'Total Number of Adverse Reaction Reports': [2, 1],\n",
|
||||||
" 'Deaths': [2, 1],\n",
|
" 'Deaths': [2, 1],\n",
|
||||||
" 'Disabilities': [1, 0],\n",
|
" 'Disabilities': [1, 0],\n",
|
||||||
" 'Life Threatening Illnesses': [1, 0],\n",
|
" 'Life Threatening Illnesses': [1, 0],\n",
|
||||||
@@ -827,7 +827,7 @@
|
|||||||
" doseByMonthTable,\n",
|
" doseByMonthTable,\n",
|
||||||
" pd.DataFrame(\n",
|
" pd.DataFrame(\n",
|
||||||
" data = {\n",
|
" data = {\n",
|
||||||
" 'Total reports': [2, 1],\n",
|
" 'Total Number of Adverse Reaction Reports': [2, 1],\n",
|
||||||
" 'Deaths': [2, 1],\n",
|
" 'Deaths': [2, 1],\n",
|
||||||
" 'Disabilities': [1, 0],\n",
|
" 'Disabilities': [1, 0],\n",
|
||||||
" 'Life Threatening Illnesses': [1, 0],\n",
|
" 'Life Threatening Illnesses': [1, 0],\n",
|
||||||
@@ -876,7 +876,7 @@
|
|||||||
" assert_frame_equal(\n",
|
" assert_frame_equal(\n",
|
||||||
" internationalLotTable,\n",
|
" internationalLotTable,\n",
|
||||||
" TestHelper.createDataFrame(\n",
|
" TestHelper.createDataFrame(\n",
|
||||||
" columns = ['Total reports', 'Deaths', 'Disabilities', 'Life Threatening Illnesses', 'Severe reports (%)'],\n",
|
" columns = ['Total Number of Adverse Reaction Reports', 'Deaths', 'Disabilities', 'Life Threatening Illnesses', 'Severe reports (%)'],\n",
|
||||||
" data = [ [2, 2, 1, 1, (2 + 1 + 1) / 2 * 100],\n",
|
" data = [ [2, 2, 1, 1, (2 + 1 + 1) / 2 * 100],\n",
|
||||||
" [1, 1, 0, 0, (1 + 0 + 0) / 1 * 100],\n",
|
" [1, 1, 0, 0, (1 + 0 + 0) / 1 * 100],\n",
|
||||||
" [2, 0, 0, 0, (0 + 0 + 0) / 2 * 100]],\n",
|
" [2, 0, 0, 0, (0 + 0 + 0) / 2 * 100]],\n",
|
||||||
@@ -910,7 +910,7 @@
|
|||||||
" assert_frame_equal(\n",
|
" assert_frame_equal(\n",
|
||||||
" batchCodeTable,\n",
|
" batchCodeTable,\n",
|
||||||
" TestHelper.createDataFrame(\n",
|
" TestHelper.createDataFrame(\n",
|
||||||
" columns = ['Total reports', 'Deaths', 'Disabilities', 'Life Threatening Illnesses', 'Severe reports (%)'],\n",
|
" columns = ['Total Number of Adverse Reaction Reports', 'Deaths', 'Disabilities', 'Life Threatening Illnesses', 'Severe reports (%)'],\n",
|
||||||
" data = [ [2, 1, 2, 2, (1 + 2 + 2) / 2 * 100],\n",
|
" data = [ [2, 1, 2, 2, (1 + 2 + 2) / 2 * 100],\n",
|
||||||
" [1, 1, 0, 0, (1 + 0 + 0) / 1 * 100]],\n",
|
" [1, 1, 0, 0, (1 + 0 + 0) / 1 * 100]],\n",
|
||||||
" index = pd.Index(\n",
|
" index = pd.Index(\n",
|
||||||
@@ -1115,7 +1115,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"internationalLotTable = internationalLotTable[internationalLotTable['Total reports'] > 50]\n",
|
"internationalLotTable = internationalLotTable[internationalLotTable['Total Number of Adverse Reaction Reports'] > 50]\n",
|
||||||
"IOUtils.saveDataFrame(internationalLotTable, 'results/international/International_Deadly_Lots')\n",
|
"IOUtils.saveDataFrame(internationalLotTable, 'results/international/International_Deadly_Lots')\n",
|
||||||
"internationalLotTable"
|
"internationalLotTable"
|
||||||
]
|
]
|
||||||
@@ -1129,7 +1129,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"def createAndSaveAndDisplayBatchCodeTableByCountry(nonDomesticVaers, country):\n",
|
"def createAndSaveAndDisplayBatchCodeTableByCountry(nonDomesticVaers, country):\n",
|
||||||
" batchCodeTable = InternationalLotTableFactory.createBatchCodeTableByCountry(nonDomesticVaers, country)\n",
|
" batchCodeTable = InternationalLotTableFactory.createBatchCodeTableByCountry(nonDomesticVaers, country)\n",
|
||||||
" batchCodeTable = batchCodeTable[batchCodeTable['Total reports'] > 50]\n",
|
" batchCodeTable = batchCodeTable[batchCodeTable['Total Number of Adverse Reaction Reports'] > 50]\n",
|
||||||
" IOUtils.saveDataFrame(batchCodeTable, 'results/international/' + country)\n",
|
" IOUtils.saveDataFrame(batchCodeTable, 'results/international/' + country)\n",
|
||||||
" display(country + \":\", batchCodeTable)\n",
|
" display(country + \":\", batchCodeTable)\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user