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

Extract episodes: rename() got an unexpected keyword argument "axis" #96

Closed nicenoize closed 4 years ago

nicenoize commented 4 years ago

Hey! When trying to perform step 4) and run the script to extract the episodes, I receive a type error, which is caused by rename() being called with "axis" as argument. According to the pandas documentary, axis is a valid argument. Does anybody else have this problem and came up with a fix for it? Here's the Traceback: Traceback (most recent call last): File "/Users/nicenoize/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/Users/nicenoize/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Volumes/Backup/COP/mimic3-benchmarks/mimic3benchmark/scripts/extract_episodes_from_subjects.py", line 26, in <module> var_map = read_itemid_to_variable_map(args.variable_map_file) File "/Volumes/Backup/COP/mimic3-benchmarks/mimic3benchmark/preprocessing.py", line 119, in read_itemid_to_variable_map return var_map.rename({variable_column: 'VARIABLE', 'MIMIC LABEL': 'MIMIC_LABEL'}, axis=1) File "/Users/nicenoize/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py", line 2746, in rename **kwargs) File "/Users/nicenoize/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py", line 694, in rename 'argument "{0}"'.format(list(kwargs.keys())[0]))

bbardakk commented 4 years ago

Just update your pandas library to version 0.21 or higher.

pip install -U pandas==0.21

hrayrhar commented 4 years ago

Yes, just updating pandas to the version in the requirements.txt would solve the issue. This issue happens because recently I replaced the old deprecated function rename_axis.