看板 Python 關於我們 聯絡資訊
https://gist.github.com/anonymous/01d0536745d9814815081aa03d547bc7 上面程式碼我想針對標題是 "獲 利 狀 況" 抓取表格 那要如何字串比對 "獲 利 狀 況" 找道是在list裡面的哪個index? 下面是我測試 2103 股票在第41個index, 但其他檔股票 "獲 利 狀 況" 可能不是在41 index df2=pd.DataFrame(df[41]) http://goodinfo.tw/StockInfo/StockDetail.asp?STOCK_ID=2103 謝謝 -- -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.71.54.71 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1487436137.A.4DC.html ※ 編輯: yshihyu (223.136.40.134), 02/19/2017 01:53:29
physheepy: 資料量不大的話 if df[i].loc[0,0] == "XXXX": print i 02/19 02:42
yshihyu: http://0rz.tw/vvLyN 02/19 05:42
yshihyu: 你的方法可以但是list 裡面有些資料型態不是unicode 02/19 05:43
yshihyu: 會出現一些warning , 不知道這樣如何處理? 02/19 05:43
yshihyu: <type 'numpy.float64'> 遇到這就會出現 warning 02/19 05:44
physheepy: 這樣不會影響結果吧? 是數字的欄位就不是你要找的 02/19 11:17
physheepy: warning 不是 error 02/19 11:18
physheepy: 那個warning只是提醒你 你想比對的欄位不是 unicode 02/19 11:24