[請益] 如何顯示欄位名稱且並存入xlsx裡面?

作者: han999 (鎧材校直定尺切斷機)   2018-01-03 23:15:03
我先附上Python 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
懇請指點一下<(_ _)>
作者: a3236852 (serena)   2018-01-03 23:16:00
這比較適合到python板發問吧
作者: MOONY135 (談無慾)   2018-01-04 00:16:00
你少打欄位吧

Links booklink

Contact Us: admin [ a t ] ucptt.com