Use as_frame=False when calling fetch_openml()

This commit is contained in:
Aurélien Geron
2021-03-02 09:29:06 +13:00
parent 5663779ae8
commit 346dfe6d1e
4 changed files with 35 additions and 7 deletions

View File

@@ -452,6 +452,13 @@
"## Feature importance"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Warning:** since Scikit-Learn 0.24, `fetch_openml()` returns a Pandas `DataFrame` by default. To avoid this and keep the same code as in the book, we use `as_frame=False`."
]
},
{
"cell_type": "code",
"execution_count": 25,
@@ -460,7 +467,7 @@
"source": [
"from sklearn.datasets import fetch_openml\n",
"\n",
"mnist = fetch_openml('mnist_784', version=1)\n",
"mnist = fetch_openml('mnist_784', version=1, as_frame=False)\n",
"mnist.target = mnist.target.astype(np.uint8)"
]
},
@@ -1395,7 +1402,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.8"
"version": "3.7.9"
},
"nav_menu": {
"height": "252px",