MLforHealth/MIMIC_Extract

KeyError: 'subject_id" when calling pd.DataFrame.pivot_table in mortality / LOS baseline

jamin-chen opened this issue · 2 comments

Hello, I'm currently running through the notebook for predicting mortality / LOS, and got the following error when running the cell that calls pd.DataFrame.pivot_table:

image

For reference, this is what one of the dataframes looks like:

image

Could I get some help with this? What is the intended operation / output of this cell? Thanks 😄

I was able to run the code and train the models with the following change:

df.reset_index().pivot_table(...

though it does fail the null assertion at the end of the cell:

for df in lvl2_train, lvl2_dev, lvl2_test, raw_train, raw_dev, raw_test: assert not df.isnull().any().any()

Is this fix the right way to go?

Hi, may I ask where did you find the h5 files for the third cell:
DATA_FILEPATH = '/scratch/mmd/mimic_data/final/grouping_5/all_hourly_data.h5' RAW_DATA_FILEPATH = '/scratch/mmd/mimic_data/final/nogrouping_5/all_hourly_data.h5'