i want to create a simple GUI form, which asks user to browse file and then display result, i have wrote following code :
import numpy as np
import pandas as pd
from tkinter import *
from tkinter.filedialog import askopenfilename
def read_file():
filename =askopenfilename()
label1.insert(0,filename)
return
def display_file():
filename1 =label1.get()
data =pd.read_csv(filename1)
print(data.head())
root =Tk()
#root.withdraw()
label1 =Entry(root,width=100)
button =Button(root,text="Read csv file",command=read_file)
button1 =Button(root,text="Display file",command=display_file)
button.pack()
label1.pack()
button1.pack()
root.mainloop()
when i click read csv file, it gives me possibility to read file and result is like this :

now i need display part :
def display_file():
filename1 =label1.get()
data =pd.read_csv(filename1)
print(data.head())
this function just display files in working directory, but i need to show(5 rows of dataframe) in GUI form, let us suppose that file contains just two column - please tell me how to do? i have searched a lot but could not find exact solution (different solutions was presented and i was confused)
