0
votes

I have two lines of code

from sklearn.datasets import load_wine

X, y = load_wine(as_frame=True, return_X_y=True)

And I'm getting the following message:

TypeError                                 Traceback (most recent call last)

<ipython-input-19-a85f1453ccf2> in <module>()
      1 from sklearn.datasets import load_wine
      2 
----> 3 X, y = load_wine(as_frame=True, return_X_y=True)

TypeError: load_wine() got an unexpected keyword argument 'as_frame'

If I take off the argument as_frame the code works fine, but it isn't what I need.

How do I fix it? Thank you

1
can you confirm the version of sklearn you are using. ` as_frame` parameter was introduced in 0.23 . - Rajat Mishra
I'm using google collab, I dont know how to check that in a collab. - Martín Funes
import sklearn; print(sklearn.__version__) - Rajat Mishra
Oh, I see. The version is 0.22.2.post1. Do you know how to import the last version or 0.23? Thank you man - Martín Funes

1 Answers

2
votes

as_frame parameter was introduced in scikit-learn 0.23 version.

To install the scikit-learn 0.23 version, use the following command :

pip install scikit-learn==0.23