formating

This commit is contained in:
frankknoll
2022-01-25 21:20:17 +01:00
parent e7d85c2e08
commit 7c3654d05f

View File

@@ -23,16 +23,16 @@
"source": [
"def createDataFrame(dataDir, manufacturer):\n",
" def read_csv(file, usecols):\n",
" return pd.read_csv(file, index_col='VAERS_ID', encoding='latin1', low_memory=False, usecols=usecols)\n",
" \n",
" return pd.read_csv(file, index_col = 'VAERS_ID', encoding = 'latin1', low_memory = False, usecols = usecols)\n",
"\n",
" def createDataFrameForYear(year):\n",
" folder = dataDir + \"/\" + year + \"VAERSData/\"\n",
" return pd.merge(\n",
" read_csv(folder + year + \"VAERSDATA.csv\", ['VAERS_ID','DIED', 'L_THREAT', 'DISABLE']),\n",
" read_csv(folder + year + \"VAERSVAX.csv\", ['VAERS_ID','VAX_TYPE', 'VAX_MANU', 'VAX_LOT']),\n",
" left_index=True,\n",
" right_index=True)\n",
" \n",
" read_csv(folder + year + \"VAERSDATA.csv\", ['VAERS_ID', 'DIED', 'L_THREAT', 'DISABLE']),\n",
" read_csv(folder + year + \"VAERSVAX.csv\", ['VAERS_ID', 'VAX_TYPE', 'VAX_MANU', 'VAX_LOT']),\n",
" left_index = True,\n",
" right_index = True)\n",
"\n",
" df = pd.concat([createDataFrameForYear(\"2021\"), createDataFrameForYear(\"2022\")])\n",
" return df[(df[\"VAX_TYPE\"] == \"COVID19\") & (df[\"VAX_MANU\"] == manufacturer)]"
]
@@ -133,12 +133,12 @@
" 'DISABILITIES': [2, 0],\n",
" 'LIFE THREATENING ILLNESSES': [0.0, 0.0]\n",
" },\n",
" index=pd.MultiIndex.from_arrays([['025L20A', '037K20A']], names=('VAX_LOT',)))\n",
" index = pd.MultiIndex.from_arrays([['025L20A', '037K20A']], names = ('VAX_LOT',)))\n",
" display(\"actual:\", pivotTable)\n",
" display(\"expected:\", pivotTableExpected)\n",
"\n",
" # Then\n",
" assert_frame_equal(pivotTable, pivotTableExpected, check_dtype=False)\n"
" assert_frame_equal(pivotTable, pivotTableExpected, check_dtype = False)\n"
]
},
{