AttributeError: 'Index' object has no attribute 'contains' while using the predict method
aagrawal357 opened this issue · 5 comments
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!
Hi,
we did update the dependencies and refactored the code where needed, but I guess the code was not released on pypi yet.
You could try and install the package from source to get the latest version with:
git clone git@github.com:awslabs/datawig.git
cd datawig
python3 -m venv venv
./venv/bin/pip install -e .
Thank you for your response! I'll try that and shall update you.
Did this work?
No, it didn't for me. I am getting access/security issues while doing git clone git@github.com:awslabs/datawig.git
I haven't found time to investigate why.
Is there an answer for this yet ? And also is there by any chance that .transform return the same value as .predict but it just with reformat index and in dictionary form ? I got this problem when run it on google colab notebook but just fine when using kaggle notebook