HealthCatalyst / healthcareai-py

Python tools for healthcare machine learning
http://healthcare.ai
MIT License
316 stars 188 forks source link

module 'pandas.core.common' has no attribute 'is_categorical_dtype' error #473

Closed SameerMahajan-GSLab closed 6 years ago

SameerMahajan-GSLab commented 6 years ago

I followed instructions to use this under docker.

When I try to run the first example I get an error of:

module 'pandas.core.common' has no attribute 'is_categorical_dtype' at line:

classification_trainer = healthcareai.SupervisedModelTrainer(
    dataframe=dataframe,
    predicted_column='ThirtyDayReadmitFLG',
    model_type='classification',
    grain_column='PatientEncounterID',
    impute=True,
    verbose=False)

How do I get around it? When would it be fixed?

The pandas version seems to be 0.23.1. Though code in transformers.py seems to be still referring to pandas.core.common.is_categorical_dtype which I believe has now moved to pandas.api.types.is_categorical_dtype

SameerMahajan-GSLab commented 6 years ago

When I fix the error above in my local repository it goes ahead and fails at line:

X = pd.get_dummies(X, columns=columns_to_dummify, drop_first=True, prefix_sep='.')

in transformers.py with error of:

ValueError: Must pass DataFrame with boolean values only

SameerMahajan-GSLab commented 6 years ago

This seems to be due to change in behavior of select_dtypes return value. It requires another fix in transformers.py. After all these changes I have the examples working now. I would submit a pull request for these fixes.

SameerMahajan-GSLab commented 6 years ago

I have submitted https://github.com/HealthCatalyst/healthcareai-py/pull/476 to fix these.

SameerMahajan-GSLab commented 6 years ago

It is fixed by https://github.com/HealthCatalyst/healthcareai-py/pull/476