我先附上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
懇請指點一下<(_ _)>