formating
This commit is contained in:
@@ -23,16 +23,16 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"def createDataFrame(dataDir, manufacturer):\n",
|
"def createDataFrame(dataDir, manufacturer):\n",
|
||||||
" def read_csv(file, usecols):\n",
|
" def read_csv(file, usecols):\n",
|
||||||
" return pd.read_csv(file, index_col='VAERS_ID', encoding='latin1', low_memory=False, usecols=usecols)\n",
|
" return pd.read_csv(file, index_col = 'VAERS_ID', encoding = 'latin1', low_memory = False, usecols = usecols)\n",
|
||||||
" \n",
|
"\n",
|
||||||
" def createDataFrameForYear(year):\n",
|
" def createDataFrameForYear(year):\n",
|
||||||
" folder = dataDir + \"/\" + year + \"VAERSData/\"\n",
|
" folder = dataDir + \"/\" + year + \"VAERSData/\"\n",
|
||||||
" return pd.merge(\n",
|
" return pd.merge(\n",
|
||||||
" read_csv(folder + year + \"VAERSDATA.csv\", ['VAERS_ID','DIED', 'L_THREAT', 'DISABLE']),\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",
|
" read_csv(folder + year + \"VAERSVAX.csv\", ['VAERS_ID', 'VAX_TYPE', 'VAX_MANU', 'VAX_LOT']),\n",
|
||||||
" left_index=True,\n",
|
" left_index = True,\n",
|
||||||
" right_index=True)\n",
|
" right_index = True)\n",
|
||||||
" \n",
|
"\n",
|
||||||
" df = pd.concat([createDataFrameForYear(\"2021\"), createDataFrameForYear(\"2022\")])\n",
|
" df = pd.concat([createDataFrameForYear(\"2021\"), createDataFrameForYear(\"2022\")])\n",
|
||||||
" return df[(df[\"VAX_TYPE\"] == \"COVID19\") & (df[\"VAX_MANU\"] == manufacturer)]"
|
" return df[(df[\"VAX_TYPE\"] == \"COVID19\") & (df[\"VAX_MANU\"] == manufacturer)]"
|
||||||
]
|
]
|
||||||
@@ -133,12 +133,12 @@
|
|||||||
" 'DISABILITIES': [2, 0],\n",
|
" 'DISABILITIES': [2, 0],\n",
|
||||||
" 'LIFE THREATENING ILLNESSES': [0.0, 0.0]\n",
|
" 'LIFE THREATENING ILLNESSES': [0.0, 0.0]\n",
|
||||||
" },\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(\"actual:\", pivotTable)\n",
|
||||||
" display(\"expected:\", pivotTableExpected)\n",
|
" display(\"expected:\", pivotTableExpected)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # Then\n",
|
" # Then\n",
|
||||||
" assert_frame_equal(pivotTable, pivotTableExpected, check_dtype=False)\n"
|
" assert_frame_equal(pivotTable, pivotTableExpected, check_dtype = False)\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user