datawig
datawig copied to clipboard
AttributeError: 'Index' object has no attribute 'contains' while using the predict method
AttributeError Traceback (most recent call last)
~/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 [email protected]: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 [email protected]: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