Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. import pandas as pd
  2. import io
  3. import webbrowser
  4. import tkinter as tk
  5. from tkinter import filedialog
  6. import seaborn as sb
  7.  
  8. root= tk.Tk()
  9.  
  10. canvas1 = tk.Canvas(root, width = 300, height = 300, bg = 'lightsteelblue2', relief = 'raised')
  11. canvas1.pack()
  12.  
  13. def getCSV ():
  14.     global df
  15.     filepath = filedialog.askopenfilename()
  16.     data = pd.read_csv(filepath)
  17.     df = pd.DataFrame(data, columns=['Name', 'Age', 'Nationality', 'Club', 'Release Clause', 'Overall'])
  18.     df2 = pd.DataFrame(data, columns=['Overall'])
  19.     #df = data
  20.     #print (df)
  21.     html = df.to_html()
  22.     text_file = io.open("index.html", "w", encoding="utf-8")
  23.     text_file.write(html)
  24.     text_file.close()
  25.     webbrowser.open('index.html')
  26.     print(type(data))
  27.     sb.distplot(df2)
  28.  
  29. importGUI = tk.Button(text="Import CSV File", command=getCSV, bg='white', fg='black', font=('youtube-sans-light', 16))
  30. canvas1.create_window(150, 150, window=importGUI)
  31.  
  32. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement