[問題] 如何顯示欄位名稱且並存入xlsx裡面?
我先附上code,本人摸索自學中,還望見諒~
import pandas as pd
import html5lib
import openpyxl
import sys
import xlwt
import numpy
table = pd.read_html('file:///C:/T24/Case8/db.html')
T0 = table[0].dropna(axis=0)
display(T0)
T1 = table[1].dropna(axis=0)
writer = pd.ExcelWriter('T0103.xlsx')
Sh1 = T0.to_excel(writer,'Sheet1')
Sh2 = T1.to_excel(writer,'Sheet2')
writer.save()
在display(T0)呈現的欄位是
| 0 | 1 | 2 | 3 | 4
0 | Table24 | 43 | 14 | 13 | 1
而不是圖片綠框的欄位名稱 https://i.imgur.com/QDdfTfg.jpg

問題:請問要怎麼顯示且並存入xlsx裡面?我是漏打了甚麼嗎?
我要呈現的display(T0)欄位是
TABLE | TOTAL-NB-TP | NB-TP-EXECUTED | NB-OF-PASS | NB-OF-FAIL
TABLE24 | 43 | 14 | 13 | 1
懇請指點一下<(_ _)>
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.224.40.45
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1514991813.A.B38.html
※ 編輯: han999 (36.224.40.45), 01/03/2018 23:23:19
推
01/04 10:27,
8年前
, 1F
01/04 10:27, 1F
→
01/04 10:28,
8年前
, 2F
01/04 10:28, 2F
→
01/04 10:29,
8年前
, 3F
01/04 10:29, 3F
→
01/04 10:29,
8年前
, 4F
01/04 10:29, 4F
→
01/04 10:31,
8年前
, 5F
01/04 10:31, 5F
→
01/04 10:33,
8年前
, 6F
01/04 10:33, 6F
※ 編輯: han999 (36.224.40.45), 01/04/2018 22:11:54