Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aagrawal357 opened this issue Apr 1, 2022 · 5 comments

Comments

@aagrawal357
Copy link


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!

@felixbiessmann
Copy link
Contributor

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 .

@aagrawal357
Copy link
Author

Thank you for your response! I'll try that and shall update you.

@RDEvans31
Copy link

Did this work?

@aagrawal357
Copy link
Author

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.

@KyleeValencia
Copy link

KyleeValencia commented Jul 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants