I am trying to let user choose desired number of inputs from an imported cvs file, and assign it as inputs of a machine learning. Can someone please help me? I do not know tkinter and how I can convert df['input1'] to something that is OK for tkinter envirenmot. Many Thanks

import tkinter as tk

from tkinter.filedialog import askopenfilename

import pandas as pd

def import_csv_data():
    global v
    csv_file_path = askopenfilename()
    print(csv_file_path)
    v.set(csv_file_path)
    df = pd.read_csv(csv_file_path)
    print(df.head())

root = tk.Tk()


tk.Label(root, text='File Path').grid(row=0, column=0)
v = tk.StringVar()
entry = tk.Entry(root, textvariable=v).grid(row=0, column=1)
tk.Button(root, text='BrowseDataSet',command=import_csv_data).grid(row=1, column=0)
tk.Button(root, text='Close',command=root.destroy).grid(row=1, column=1)

######

#What to write here to let user choose desired inputs to be assigned to:

X= User checkbox by Tkinter
y=df['target']
#then goes for machine learning part
root.mainloop()

0 Answers