naming index

This commit is contained in:
frankknoll
2022-01-31 22:16:13 +01:00
parent 74583a0fb4
commit 360cbb3b25

View File

@@ -117,6 +117,7 @@
" return createManufacturerByBatchCodeTable(df).rename(columns = {\"VAX_MANU\": \"COMPANY\"})\n",
"\n",
"# create table from https://www.howbadismybatch.com/combined.html\n",
"# FK-TODO: DRY with createBatchCodeTable()\n",
"def createSevereEffectsBatchCodeTable(df):\n",
" def filterDataFrame(df, col):\n",
" return df[df[col] == 'Y']['VAX_LOT']\n",
@@ -130,6 +131,7 @@
" 'EMERGENCY ROOM OR DOCTOR VISITS': filterDataFrame(df, 'ER_VISIT').value_counts()\n",
" }\n",
" batchCodeTable = pd.concat(batchCodeTableDict, axis = 'columns')\n",
" batchCodeTable.index.name = 'VAX_LOT'\n",
" # add Company column:\n",
" batchCodeTable = pd.merge(\n",
" batchCodeTable,\n",
@@ -454,7 +456,7 @@
" 'EMERGENCY ROOM OR DOCTOR VISITS': [1, 1],\n",
" 'COMPANY': ['MODERNA', 'PFIZER\\BIONTECH']\n",
" },\n",
" index = pd.Index(['037K20A', '025L20A']))\n",
" index = pd.Index(['037K20A', '025L20A'], name='VAX_LOT'))\n",
" assert_frame_equal(batchCodeTable, batchCodeTableExpected, check_dtype = False)\n",
"\n",
" def createDataFrame(self, index, columns, data, dtypes = {}):\n",