Open only the Windows Explorer in Pandas - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Open only the Windows Explorer in Pandas (/thread-32037.html) |
Open only the Windows Explorer in Pandas - doug2019 - Jan-16-2021 Hello! How can I open only the workbook to choose the .csv files I want to open with pandas? I know the method of the entire path to the file and not only to the workbook. RE: Open only the workbook in pandas - jefsummers - Jan-16-2021 Question does not quite make sense. What notebook software are you using? Jupyter? Colab? VSCode? You want to open the notebook and then load the contents of a csv file into a Pandas dataframe? Your question leaves me guessing. Open only the Windows Explorer in Pandas - doug2019 - Jan-17-2021 I'm sorry. I think I didn't explain it properly. I want to write Python code that opens a window for me to choose the .csv or .xlsx files on directory just like the one in the attached image window. And yes, loading the contents of a .csv or .xlsx file into a Pandas dataframe. I'm using the Anaconda. RE: Open only the Windows Explorer in Pandas - jefsummers - Jan-17-2021 You want a file selector. First you need to decide which GUI you plan to use and look up how to use a file selector with that. I use wx, and the file selector widget is at https://wxpython.org/Phoenix/docs/html/wx.FilePickerCtrl.html Tkinter is probably the most popular GUI, and the file selector is described at https://docs.python.org/3/library/dialog.html RE: Open only the Windows Explorer in Pandas - doug2019 - Jan-17-2021 Great!!! The application I am building is for loading different .csv or .xlsx files so I would only need access to the folder where they will be. I just know how to write the code in Pandas to load only one file. RE: Open only the Windows Explorer in Pandas - jefsummers - Jan-19-2021 import pandas as pd df = pd.read_csv('blah.csv') df1 = pd.read_excel('blah.xls')So, use the dialog to select the file, then use the pd.read_xxx routines to read the file selected. |