YerevaNN / mimic3-benchmarks

Python suite to construct benchmark machine learning datasets from the MIMIC-III 💊 clinical database.
https://arxiv.org/abs/1703.07771
MIT License
805 stars 329 forks source link

raise KeyError(f"{not_found} not in index") #142

Open daiyl opened 8 months ago

daiyl commented 8 months ago

KeyError: '[200161, 200177, 200197, 200208,..., 299962, 299993] not in index'

The error occurred when it called "make_phenotype_label_matrix(phenotypes, stays=None)" because of this line "phenotypes = phenotypes.loc[stays.ICUSTAY_ID.sort_values()]"

line 98, in make_phenotype_label_matrix phenotypes = phenotypes.loc[stays.ICUSTAY_ID.sort_values()]

Why are so many ICUSTAY_IDs not in the phenotypes? Can I discard these ICUSTAY_IDs?

BTW, the original codes seem not runnable. DataFrame object has no attribute 'ix', I have replaced all the ".ix" to ".loc".