如何使用python删除列索引?

2024-10-01 07:17:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我想删除组合框中显示为值的列索引。 下面是我的组合框现在的样子:

(内部显示的所有数字均为列索引)

从组合框图像中可以看到,它非常混乱

combobox

输出应如下所示:

output

数据样本:

data

df = pd.read_excel ('N:/TEST/TEST UTILIZATION/IA 2020/Dev/SCS-FT-IE-Report.xlsm', sheet_name= 'FT')
df.sort_values("Customer Name", inplace = True) 
df.drop_duplicates(subset ="Customer Name", inplace = True)
df3 = pd.DataFrame(df, columns = ["Customer Name"])
df3.style.hide_index()

comboExample = ttk.Combobox(window, width=40, values=df3, state="readonly")
comboExample.current(0)
comboExample.grid(column=2, row=2)

我试过使用df.reset_indexdf.style.hide_index,但它不起作用。有没有办法解决这个问题

谢谢大家的帮助!:-)


Tags: nametesttruedfindexstylecustomerhide