3.9 KiB
3.9 KiB
In [2]:
from sklearn.datasets import fetch_openml
mushroom = fetch_openml(data_id=43922, as_frame=True)
X = mushroom.data
y = mushroom.target
print("Feature data:", X.shape)
print("Target data:", y.shape)
display(X.head())
display(y.head())
print(y.value_counts())[0;31m---------------------------------------------------------------------------[0m [0;31mModuleNotFoundError[0m Traceback (most recent call last) Cell [0;32mIn[2], line 1[0m [0;32m----> 1[0m [38;5;28;01mfrom[39;00m[38;5;250m [39m[38;5;21;01msklearn[39;00m[38;5;21;01m.[39;00m[38;5;21;01mdatasets[39;00m[38;5;250m [39m[38;5;28;01mimport[39;00m fetch_openml [1;32m 3[0m mushroom [38;5;241m=[39m fetch_openml(data_id[38;5;241m=[39m[38;5;241m43922[39m, as_frame[38;5;241m=[39m[38;5;28;01mTrue[39;00m) [1;32m 5[0m X [38;5;241m=[39m mushroom[38;5;241m.[39mdata [0;31mModuleNotFoundError[0m: No module named 'sklearn'
In [3]:
print("Missing cells:", X.isna().sum().sum())
print("Rows with missing cells:", X.isna().any(axis=1).sum())
print(X["stalk_root"].value_counts(dropna=False))[0;31m---------------------------------------------------------------------------[0m [0;31mNameError[0m Traceback (most recent call last) Cell [0;32mIn[3], line 1[0m [0;32m----> 1[0m [38;5;28mprint[39m([38;5;124m"[39m[38;5;124mMissing cells:[39m[38;5;124m"[39m, [43mX[49m[38;5;241m.[39misna()[38;5;241m.[39msum()[38;5;241m.[39msum()) [1;32m 2[0m [38;5;28mprint[39m([38;5;124m"[39m[38;5;124mRows with missing cells:[39m[38;5;124m"[39m, X[38;5;241m.[39misna()[38;5;241m.[39many(axis[38;5;241m=[39m[38;5;241m1[39m)[38;5;241m.[39msum()) [1;32m 3[0m [38;5;28mprint[39m(X[[38;5;124m"[39m[38;5;124mstalk_root[39m[38;5;124m"[39m][38;5;241m.[39mvalue_counts(dropna[38;5;241m=[39m[38;5;28;01mFalse[39;00m)) [0;31mNameError[0m: name 'X' is not defined
In [1]:
a = "hello"
print(a)hello