Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2695fd1df9 | ||
|
|
4a108c58ca | ||
|
|
18a6c3d189 | ||
|
|
8695b7281c |
@@ -2,246 +2,19 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 2,
|
||||||
"id": "45bdce35",
|
"id": "45bdce35",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"ename": "ModuleNotFoundError",
|
||||||
"output_type": "stream",
|
"evalue": "No module named 'sklearn'",
|
||||||
"text": [
|
"output_type": "error",
|
||||||
"Feature data: (8124, 22)\n",
|
"traceback": [
|
||||||
"Target data: (8124,)\n"
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
]
|
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
|
||||||
},
|
"Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdatasets\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m fetch_openml\n\u001b[1;32m 3\u001b[0m mushroom \u001b[38;5;241m=\u001b[39m fetch_openml(data_id\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m43922\u001b[39m, as_frame\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 5\u001b[0m X \u001b[38;5;241m=\u001b[39m mushroom\u001b[38;5;241m.\u001b[39mdata\n",
|
||||||
{
|
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'sklearn'"
|
||||||
"data": {
|
|
||||||
"text/html": [
|
|
||||||
"<div>\n",
|
|
||||||
"<style scoped>\n",
|
|
||||||
" .dataframe tbody tr th:only-of-type {\n",
|
|
||||||
" vertical-align: middle;\n",
|
|
||||||
" }\n",
|
|
||||||
"\n",
|
|
||||||
" .dataframe tbody tr th {\n",
|
|
||||||
" vertical-align: top;\n",
|
|
||||||
" }\n",
|
|
||||||
"\n",
|
|
||||||
" .dataframe thead th {\n",
|
|
||||||
" text-align: right;\n",
|
|
||||||
" }\n",
|
|
||||||
"</style>\n",
|
|
||||||
"<table border=\"1\" class=\"dataframe\">\n",
|
|
||||||
" <thead>\n",
|
|
||||||
" <tr style=\"text-align: right;\">\n",
|
|
||||||
" <th></th>\n",
|
|
||||||
" <th>cap_shape</th>\n",
|
|
||||||
" <th>cap_surface</th>\n",
|
|
||||||
" <th>cap_color</th>\n",
|
|
||||||
" <th>bruises</th>\n",
|
|
||||||
" <th>odor</th>\n",
|
|
||||||
" <th>gill_attachment</th>\n",
|
|
||||||
" <th>gill_spacing</th>\n",
|
|
||||||
" <th>gill_size</th>\n",
|
|
||||||
" <th>gill_color</th>\n",
|
|
||||||
" <th>stalk_shape</th>\n",
|
|
||||||
" <th>...</th>\n",
|
|
||||||
" <th>stalk_surface_below_ring</th>\n",
|
|
||||||
" <th>stalk_color_above_ring</th>\n",
|
|
||||||
" <th>stalk_color_below_ring</th>\n",
|
|
||||||
" <th>veil_type</th>\n",
|
|
||||||
" <th>veil_color</th>\n",
|
|
||||||
" <th>ring_number</th>\n",
|
|
||||||
" <th>ring_type</th>\n",
|
|
||||||
" <th>spore-print-color</th>\n",
|
|
||||||
" <th>population</th>\n",
|
|
||||||
" <th>habitat</th>\n",
|
|
||||||
" </tr>\n",
|
|
||||||
" </thead>\n",
|
|
||||||
" <tbody>\n",
|
|
||||||
" <tr>\n",
|
|
||||||
" <th>0</th>\n",
|
|
||||||
" <td>x</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>t</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>f</td>\n",
|
|
||||||
" <td>c</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>k</td>\n",
|
|
||||||
" <td>e</td>\n",
|
|
||||||
" <td>...</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>o</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>k</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>u</td>\n",
|
|
||||||
" </tr>\n",
|
|
||||||
" <tr>\n",
|
|
||||||
" <th>1</th>\n",
|
|
||||||
" <td>x</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>y</td>\n",
|
|
||||||
" <td>t</td>\n",
|
|
||||||
" <td>a</td>\n",
|
|
||||||
" <td>f</td>\n",
|
|
||||||
" <td>c</td>\n",
|
|
||||||
" <td>b</td>\n",
|
|
||||||
" <td>k</td>\n",
|
|
||||||
" <td>e</td>\n",
|
|
||||||
" <td>...</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>o</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>g</td>\n",
|
|
||||||
" </tr>\n",
|
|
||||||
" <tr>\n",
|
|
||||||
" <th>2</th>\n",
|
|
||||||
" <td>b</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>t</td>\n",
|
|
||||||
" <td>l</td>\n",
|
|
||||||
" <td>f</td>\n",
|
|
||||||
" <td>c</td>\n",
|
|
||||||
" <td>b</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>e</td>\n",
|
|
||||||
" <td>...</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>o</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>m</td>\n",
|
|
||||||
" </tr>\n",
|
|
||||||
" <tr>\n",
|
|
||||||
" <th>3</th>\n",
|
|
||||||
" <td>x</td>\n",
|
|
||||||
" <td>y</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>t</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>f</td>\n",
|
|
||||||
" <td>c</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>e</td>\n",
|
|
||||||
" <td>...</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>o</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>k</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>u</td>\n",
|
|
||||||
" </tr>\n",
|
|
||||||
" <tr>\n",
|
|
||||||
" <th>4</th>\n",
|
|
||||||
" <td>x</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>g</td>\n",
|
|
||||||
" <td>f</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>f</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>b</td>\n",
|
|
||||||
" <td>k</td>\n",
|
|
||||||
" <td>t</td>\n",
|
|
||||||
" <td>...</td>\n",
|
|
||||||
" <td>s</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>p</td>\n",
|
|
||||||
" <td>w</td>\n",
|
|
||||||
" <td>o</td>\n",
|
|
||||||
" <td>e</td>\n",
|
|
||||||
" <td>n</td>\n",
|
|
||||||
" <td>a</td>\n",
|
|
||||||
" <td>g</td>\n",
|
|
||||||
" </tr>\n",
|
|
||||||
" </tbody>\n",
|
|
||||||
"</table>\n",
|
|
||||||
"<p>5 rows × 22 columns</p>\n",
|
|
||||||
"</div>"
|
|
||||||
],
|
|
||||||
"text/plain": [
|
|
||||||
" cap_shape cap_surface cap_color bruises odor gill_attachment gill_spacing \\\n",
|
|
||||||
"0 x s n t p f c \n",
|
|
||||||
"1 x s y t a f c \n",
|
|
||||||
"2 b s w t l f c \n",
|
|
||||||
"3 x y w t p f c \n",
|
|
||||||
"4 x s g f n f w \n",
|
|
||||||
"\n",
|
|
||||||
" gill_size gill_color stalk_shape ... stalk_surface_below_ring \\\n",
|
|
||||||
"0 n k e ... s \n",
|
|
||||||
"1 b k e ... s \n",
|
|
||||||
"2 b n e ... s \n",
|
|
||||||
"3 n n e ... s \n",
|
|
||||||
"4 b k t ... s \n",
|
|
||||||
"\n",
|
|
||||||
" stalk_color_above_ring stalk_color_below_ring veil_type veil_color \\\n",
|
|
||||||
"0 w w p w \n",
|
|
||||||
"1 w w p w \n",
|
|
||||||
"2 w w p w \n",
|
|
||||||
"3 w w p w \n",
|
|
||||||
"4 w w p w \n",
|
|
||||||
"\n",
|
|
||||||
" ring_number ring_type spore-print-color population habitat \n",
|
|
||||||
"0 o p k s u \n",
|
|
||||||
"1 o p n n g \n",
|
|
||||||
"2 o p n n m \n",
|
|
||||||
"3 o p k s u \n",
|
|
||||||
"4 o e n a g \n",
|
|
||||||
"\n",
|
|
||||||
"[5 rows x 22 columns]"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "display_data"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": [
|
|
||||||
"0 p\n",
|
|
||||||
"1 e\n",
|
|
||||||
"2 e\n",
|
|
||||||
"3 p\n",
|
|
||||||
"4 e\n",
|
|
||||||
"Name: class, dtype: category\n",
|
|
||||||
"Categories (2, str): ['e', 'p']"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "display_data"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"class\n",
|
|
||||||
"e 4208\n",
|
|
||||||
"p 3916\n",
|
|
||||||
"Name: count, dtype: int64\n"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -262,23 +35,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 3,
|
||||||
"id": "69e1a254",
|
"id": "69e1a254",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"ename": "NameError",
|
||||||
"output_type": "stream",
|
"evalue": "name 'X' is not defined",
|
||||||
"text": [
|
"output_type": "error",
|
||||||
"Missing cells: 0\n",
|
"traceback": [
|
||||||
"Rows with missing cells: 0\n",
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
"stalk_root\n",
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||||
"b 3776\n",
|
"Cell \u001b[0;32mIn[3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMissing cells:\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[43mX\u001b[49m\u001b[38;5;241m.\u001b[39misna()\u001b[38;5;241m.\u001b[39msum()\u001b[38;5;241m.\u001b[39msum())\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRows with missing cells:\u001b[39m\u001b[38;5;124m\"\u001b[39m, X\u001b[38;5;241m.\u001b[39misna()\u001b[38;5;241m.\u001b[39many(axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m)\u001b[38;5;241m.\u001b[39msum())\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(X[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstalk_root\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mvalue_counts(dropna\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m))\n",
|
||||||
"? 2480\n",
|
"\u001b[0;31mNameError\u001b[0m: name 'X' is not defined"
|
||||||
"e 1120\n",
|
|
||||||
"c 556\n",
|
|
||||||
"r 192\n",
|
|
||||||
"Name: count, dtype: int64\n"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -287,11 +56,30 @@
|
|||||||
"print(\"Rows with missing cells:\", X.isna().any(axis=1).sum())\n",
|
"print(\"Rows with missing cells:\", X.isna().any(axis=1).sum())\n",
|
||||||
"print(X[\"stalk_root\"].value_counts(dropna=False))"
|
"print(X[\"stalk_root\"].value_counts(dropna=False))"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "a3459b1e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"hello\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"a = \"hello\"\n",
|
||||||
|
"print(a)"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": ".venv (3.12.10)",
|
"display_name": ".venv (3.9.6)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@@ -305,7 +93,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.12.10"
|
"version": "3.9.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Reference in New Issue
Block a user