[Solved] Read in a csv file as a variable in python
Here a bare code that should do what you are asking: import tkinter as tk from tkinter import filedialog from tkinter import simpledialog import pandas as pd root = tk.Tk() root.withdraw() path = filedialog.askopenfilename(parent=root, filetypes=[(“CSV Files”,”.csv”)]) col1 = simpledialog.askstring(“Input”, “Column 1″, parent=root, initialvalue=”col1”) col2 = simpledialog.askstring(“Input”, “Column 2″, parent=root, initialvalue=”col2”) df = pd.read_csv(path, usecols=[col1, col2]) … Read more