refactoring

This commit is contained in:
frankknoll
2022-01-25 10:50:14 +01:00
parent 17875bf89a
commit ce588d502a
2 changed files with 14 additions and 18 deletions

4
.gitignore vendored
View File

@@ -1,2 +1,4 @@
VAERS/ VAERS/
.ipynb_checkpoints/ .ipynb_checkpoints/
VAERSDataUseGuide_en_September2021.pdf
Vaccine Lot Numbers Expiration (1).xlsx

View File

@@ -24,22 +24,16 @@
" def read_csv(file):\n", " def read_csv(file):\n",
" return pd.read_csv(file, index_col='VAERS_ID', encoding='latin1', low_memory=False)\n", " return pd.read_csv(file, index_col='VAERS_ID', encoding='latin1', low_memory=False)\n",
" \n", " \n",
" def createPatients():\n", " def createDataFrameForYear(year):\n",
" return pd.concat(\n", " folder = \"VAERS/\" + year + \"VAERSData/\"\n",
" [\n", " return pd.merge(\n",
" read_csv(\"VAERS/2021VAERSData/2021VAERSDATA.csv\"),\n", " read_csv(folder + year + \"VAERSDATA.csv\"),\n",
" read_csv(\"VAERS/2022VAERSData/2022VAERSDATA.csv\")\n", " read_csv(folder + year + \"VAERSVAX.csv\"),\n",
" ])\n", " left_index=True,\n",
"\n", " right_index=True)\n",
" def createVax(): \n", " \n",
" return pd.concat(\n", " df = pd.concat([createDataFrameForYear(\"2021\"), createDataFrameForYear(\"2022\")])\n",
" [\n", " return df[(df[\"VAX_TYPE\"] == \"COVID19\") & (df[\"VAX_MANU\"] == manufacturer)]"
" read_csv(\"VAERS/2021VAERSData/2021VAERSVAX.csv\"),\n",
" read_csv(\"VAERS/2022VAERSData/2022VAERSVAX.csv\")\n",
" ])\n",
"\n",
" df_patients_vax = pd.merge(createPatients(), createVax(), left_index=True, right_index=True)\n",
" return df_patients_vax[(df_patients_vax[\"VAX_TYPE\"] == \"COVID19\") & (df_patients_vax[\"VAX_MANU\"] == manufacturer)]"
] ]
}, },
{ {
@@ -96,7 +90,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "fdf2ab4b", "id": "bb7b2963",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [