【发布时间】:2020-11-30 02:46:13
【问题描述】:
所以我编写了“a 列中第 n 个最大值的行号”,然后在 Tkinter 中实现,但是标签中显示的输出与控制台中的打印输出不同。假设控制台中的打印输出显示 3 列的值,因此 3 行,但 tkinter 仅显示 1 列的 1 行。
def row4Nthlargest(self):
a = pd.read_csv('https://raw.githubusercontent.com/sahdan96/film_data/main/film.csv')
b = int(self.Entry.get())
cateogry_columns = a.select_dtypes(include=['object']).columns.tolist()
integer_columns = a.select_dtypes(include=['int64', 'float64']).columns.tolist()
for column in a:
if (column in cateogry_columns):
pass
else:
ans= a.nlargest(b, [column]).iloc[-1]
self.Output_gui.configure(text = ans)
下面是我的标签代码:
self.Output_gui = tk.Label(top)
self.Output_gui.place(relx=0.027, rely=0.188, height=619, width=750)
self.Output_gui.configure(background="#ffffff")
self.Output_gui.configure(disabledforeground="#a3a3a3")
self.Output_gui.configure(foreground="#000000")
self.Output_gui.configure(justify = 'left', anchor ='nw')
self.Output_gui.configure(font=font11)
self.Output_gui.configure(wraplength="700")
【问题讨论】: