ageron / handson-ml

⛔️ DEPRECATED – See https://github.com/ageron/handson-ml3 instead.
Apache License 2.0
25.18k stars 12.92k forks source link

Update 03_classification.ipynb #627

Closed jdaviestx closed 3 years ago

jdaviestx commented 3 years ago

When I tried to run cell 2, I got the error "KeyError: "None of [Int64Index([ 1, 21, 34, 37, 51, 56, 63, 68, 69,\n 75,\n ...\n 59910, 59917, 59927, 59939, 59942, 59948, 59969, 59973, 59990,\n 59992],\n dtype='int64', length=60000)] are in the [columns]". Apparently openml is returning a Pandas Dataframe here whereas it must have used to return a Numpy array; I had to make this change to get it to work correctly.

review-notebook-app[bot] commented 3 years ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

ageron commented 3 years ago

Hi @jdaviestx ,

Thanks for the PR. Since Scikit-Learn 0.24, fetch_openml() returns a Pandas DataFrame by default, instead of a NumPy array. Just pass as_frame=False to that function and everything will work fine. I think that's the simpler solution.

Hope this helps.