Skip to content

AttributeError: 'Index' object has no attribute 'contains' while using the predict method #160

@aagrawal357

Description

@aagrawal357

AttributeError Traceback (most recent call last)
in
19 return imputed
20
---> 21 actor1_pred = predict_missing_values(original_data, "Actor1")
22 actor1_pred

in predict_missing_values(df, col)
16
17 #Impute missing values and return original dataframe with predictions
---> 18 imputed = imputer.predict(df_test)
19 return imputed
20

~/opt/anaconda3/lib/python3.8/site-packages/datawig/simple_imputer.py in predict(self, data_frame, precision_threshold, imputation_suffix, score_suffix, inplace)
417 :return: data_frame original dataframe with imputations and likelihood in additional column
418 """
--> 419 imputations = self.imputer.predict(data_frame, precision_threshold, imputation_suffix,
420 score_suffix, inplace=inplace)
421

~/opt/anaconda3/lib/python3.8/site-packages/datawig/imputer.py in predict(self, data_frame, precision_threshold, imputation_suffix, score_suffix, inplace)
820 for label, imputations in predictions:
821 imputation_col = label + imputation_suffix
--> 822 if data_frame.columns.contains(imputation_col):
823 raise ColumnOverwriteException(
824 "DataFrame contains column {}; remove column and try again".format(

AttributeError: 'Index' object has no attribute 'contains'

I saw a similar issue (#118 ) and the suggestion was to go back to pandas 0.25.0. I have pandas 1.2.4 and going back to 0.25.0 is not an option since it's deprecated. Is there a resolution or a workaround for this? Any pointers will be appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions