iT邦幫忙

0

下載完scikit-learn 到anaconda 後原本能運行的部分出現keyerror: 0

在做MNIST數據練習時因為並未下載scikit-learn 所以跑去ANACONDA.NAVIGATIOR 去下載
回來後重跑一次就出現這個畫面 在網路上找不到相關的解法 想求助各位
https://ithelp.ithome.com.tw/upload/images/20210913/20141871cWp5c3QE8A.pnghttps://ithelp.ithome.com.tw/upload/images/20210913/20141871go9a26aTrf.png

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1
Greysuki
iT邦新手 5 級 ‧ 2021-09-13 16:07:53

Google水準有待提升
https://ithelp.ithome.com.tw/upload/images/20210913/20141586NAajkgoHh5.png
https://ithelp.ithome.com.tw/upload/images/20210913/20141586cC28JXGlV9.png

回到主題,新版本的fetch_openml預設回傳Dataframe
你需要用x.loc去取得資料

# %%
from sklearn.datasets import fetch_openml

# %%

mnist = fetch_openml("mnist_784")
print(mnist)
# %%
x = mnist["data"]

# %%
x

# %%
x[0]

https://ithelp.ithome.com.tw/upload/images/20210913/20141586tcQi8SnarP.png

我要發表回答

立即登入回答