saving excel files to sub folders
This commit is contained in:
@@ -884,6 +884,25 @@
|
|||||||
"unittest.main(argv = [''], verbosity = 2, exit = False)"
|
"unittest.main(argv = [''], verbosity = 2, exit = False)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "49f3544e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import os\n",
|
||||||
|
"\n",
|
||||||
|
"def ensurePath(file):\n",
|
||||||
|
" directory = os.path.dirname(file)\n",
|
||||||
|
" if not os.path.exists(directory):\n",
|
||||||
|
" os.makedirs(directory)\n",
|
||||||
|
"\n",
|
||||||
|
"def saveDataFrameAsExcelFile(dataFrame, file):\n",
|
||||||
|
" ensurePath(file)\n",
|
||||||
|
" dataFrame.to_excel(file)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@@ -897,7 +916,7 @@
|
|||||||
" DataFrameNormalizer.normalize(dataFrame)\n",
|
" DataFrameNormalizer.normalize(dataFrame)\n",
|
||||||
" batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(dataFrame, manufacturer = manufacturer, dose = '1')\n",
|
" batchCodeTable = BatchCodeTableFactory.createBatchCodeTable(dataFrame, manufacturer = manufacturer, dose = '1')\n",
|
||||||
" display(batchCodeTable)\n",
|
" display(batchCodeTable)\n",
|
||||||
" batchCodeTable.to_excel(excelFile)"
|
" saveDataFrameAsExcelFile(batchCodeTable, excelFile)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -916,7 +935,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# https://www.howbadismybatch.com/moderna.html\n",
|
"# https://www.howbadismybatch.com/moderna.html\n",
|
||||||
"saveBatchCodeTable(\"MODERNA\", \"results/moderna.xlsx\")"
|
"saveBatchCodeTable(\"MODERNA\", \"results/batchCodes/moderna.xlsx\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -935,7 +954,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# https://www.howbadismybatch.com/pfizer.html\n",
|
"# https://www.howbadismybatch.com/pfizer.html\n",
|
||||||
"saveBatchCodeTable(\"PFIZER\\BIONTECH\", \"results/pfizer.xlsx\")"
|
"saveBatchCodeTable(\"PFIZER\\BIONTECH\", \"results/batchCodes/pfizer.xlsx\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -954,7 +973,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# https://www.howbadismybatch.com/janssen.html\n",
|
"# https://www.howbadismybatch.com/janssen.html\n",
|
||||||
"saveBatchCodeTable(\"JANSSEN\", \"results/janssen.xlsx\")"
|
"saveBatchCodeTable(\"JANSSEN\", \"results/batchCodes/janssen.xlsx\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -978,7 +997,7 @@
|
|||||||
" DataFrameNormalizer.normalize(dataFrame)\n",
|
" DataFrameNormalizer.normalize(dataFrame)\n",
|
||||||
" severeEffectsBatchCodeTable = BatchCodeTableFactory.createSevereEffectsBatchCodeTable(dataFrame, dose = '1')\n",
|
" severeEffectsBatchCodeTable = BatchCodeTableFactory.createSevereEffectsBatchCodeTable(dataFrame, dose = '1')\n",
|
||||||
" display(severeEffectsBatchCodeTable)\n",
|
" display(severeEffectsBatchCodeTable)\n",
|
||||||
" severeEffectsBatchCodeTable.to_excel(excelFile)"
|
" saveDataFrameAsExcelFile(severeEffectsBatchCodeTable, excelFile)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1039,7 +1058,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"doseByMonthTable = createDoseByMonthTable()\n",
|
"doseByMonthTable = createDoseByMonthTable()\n",
|
||||||
"doseByMonthTable.to_excel('results/doseByMonthTable.xlsx')\n",
|
"saveDataFrameAsExcelFile(doseByMonthTable, 'results/firstsecond/doseByMonthTable.xlsx')\n",
|
||||||
"doseByMonthTable"
|
"doseByMonthTable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1088,25 +1107,10 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"# FK-TODO: make filter on 'Total reports' a parameter in getInternationalLotTable() \n",
|
"# FK-TODO: make filter on 'Total reports' a parameter in getInternationalLotTable() \n",
|
||||||
"internationalLotTable = internationalLotTable[internationalLotTable['Total reports'] > 50]\n",
|
"internationalLotTable = internationalLotTable[internationalLotTable['Total reports'] > 50]\n",
|
||||||
"internationalLotTable.to_excel('results/International_Deadly_Lots.xlsx')\n",
|
"saveDataFrameAsExcelFile(internationalLotTable, 'results/international/International_Deadly_Lots.xlsx')\n",
|
||||||
"internationalLotTable"
|
"internationalLotTable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "a35ede95",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"# FK-TODO: jedes zu speichernde Ergebnis in passenden Order speichern\n",
|
|
||||||
"import os\n",
|
|
||||||
"\n",
|
|
||||||
"report_path = 'results/international/'\n",
|
|
||||||
"if not os.path.exists(report_path):\n",
|
|
||||||
" os.makedirs(report_path)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@@ -1117,7 +1121,7 @@
|
|||||||
"for country in ['United Kingdom', 'France', 'Germany', 'Japan', 'Italy', 'Austria', 'Netherlands', 'Spain', 'Belgium', 'Sweden', 'Portugal', 'Australia']:\n",
|
"for country in ['United Kingdom', 'France', 'Germany', 'Japan', 'Italy', 'Austria', 'Netherlands', 'Spain', 'Belgium', 'Sweden', 'Portugal', 'Australia']:\n",
|
||||||
" batchCodeTable = InternationalLotTableFactory.createBatchCodeTableByCountry(nonDomesticVaers, country)\n",
|
" batchCodeTable = InternationalLotTableFactory.createBatchCodeTableByCountry(nonDomesticVaers, country)\n",
|
||||||
" batchCodeTable = batchCodeTable[batchCodeTable['Total reports'] > 50]\n",
|
" batchCodeTable = batchCodeTable[batchCodeTable['Total reports'] > 50]\n",
|
||||||
" batchCodeTable.to_excel(report_path + country + '.xlsx')\n",
|
" saveDataFrameAsExcelFile(batchCodeTable, 'results/international/' + country + '.xlsx')\n",
|
||||||
" display(country + \":\", batchCodeTable)"
|
" display(country + \":\", batchCodeTable)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user