请帮我用tkinter打印以下python代码



我已经尝试在终端中打印print(df.nlargest(3,'Height')),但我不确定它在Tkinter中的工作方式。

这是代码:


#importing pandas as pd
from tkinter import *
from tkinter import ttk
import pandas as pd
root = Tk()
root.geometry("100x70")
#creating DataFrame
df= pd.DataFrame({'Name':['Chetan','yashas','yuvraj','Pooja','Sindu','Renuka'],'Age':  [20,25,30,18,25,20],'Height': [155,160,175,145,155,165],'Weight': [75,60,75,45,55,65]})
print(df.nlargest(3,'Height'))
root.mainloop()

请告诉我是否有办法在Tkinter Treeview中打印这3个最大的。

谢谢你的帮助!

谢谢你的帮助!

尝试添加标签:

from tkinter import *
from tkinter import ttk
import pandas as pd
root = Tk()
root.geometry("100x70")
# creating DataFrame
df = pd.DataFrame({'Name': ['Chetan', 'yashas', 'yuvraj', 'Pooja', 'Sindu', 'Renuka'], 'Age': [20, 25, 30, 18, 25, 20],
'Height': [155, 160, 175, 145, 155, 165], 'Weight': [75, 60, 75, 45, 55, 65]})
largest_items = df.nlargest(3, 'Height')
data_label = Label(root, text=str(largest_items))
data_label.pack()
root.mainloop()

相关内容

  • 没有找到相关文章

最新更新