[問題] python型別轉換

看板Python作者 (陳啟詳)時間3年前 (2020/06/14 16:38), 3年前編輯推噓1(104)
留言5則, 5人參與, 3年前最新討論串1/1
大家好,我想把train_X裡的資料全部統一成float,但試了很久依舊跑出ValueError: could not convert string to float: 'X',不太懂問題出在哪。 http://i.imgur.com/ndjNC8M.png
用了astype也一樣 http://i.imgur.com/Dxx1KsU.png
對了,train_X是ndarray http://i.imgur.com/4sb4zCd.png
-- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 110.50.175.10 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1592123899.A.CDC.html

06/14 16:57, 3年前 , 1F
阿就資料有個欄位是'X' 沒辦法轉float 檢查一下資料吧
06/14 16:57, 1F
好 感謝 ※ 編輯: Ryan45758 (110.50.175.10 臺灣), 06/14/2020 17:06:22

06/14 18:19, 3年前 , 2F
mixed type
06/14 18:19, 2F

06/14 23:57, 3年前 , 3F
python報錯已經很友善了 可能要試著學看ValueError
06/14 23:57, 3F

06/15 14:18, 3年前 , 4F
同意樓上,python報錯算很清楚了,仔細看都能解掉
06/15 14:18, 4F

06/29 16:14, 3年前 , 5F
工研院人工智慧課程推薦https://reurl.cc/4RDRaK
06/29 16:14, 5F
文章代碼(AID): #1UvU7xpS (Python)