How to view Excel File or Pandas DataFrame in Tkinter (Python GUI)

  Рет қаралды 67,824

Ramon Williams

Ramon Williams

Күн бұрын

#Tkinter #PythonExcel #PythonTutorial #Pandas #DataScience
This video will show you step by step on how to place a Pandas DataFrame or Excel File into a Tkinter GUI.
Programming Language: Python 3.7
Text Editor: Atom (The linter used is Flake8)
Libraries: Pandas, TKinter
The code can be found in the github gist below:
gist.github.com/RamonWill/068...

Пікірлер: 71
@RamonWilliams
@RamonWilliams 4 жыл бұрын
Timestamps 0:00 Intro 1:00 Creating the Root, Frames, Label and Buttons 10:00 Creating the Treeview Widget and scrollbars 14:44 Creating the button commands 16:53 Creating the File Dialog Function (opens file explorer) 19:40 Load Excel File into Treeview (what you most likely came for) 25:54 Testing the code It's probably evident but i didn't check beforehand if it works for csv files. Nevertheless for the code please see the description, the code in the description also works for csv files!
@logicalprogression9995
@logicalprogression9995 3 жыл бұрын
Works for csv's too, just need to swap out some of the File_dialogue filetype params or can feed it a list of pandas acceptable types to make it more generic.
@johndavies729
@johndavies729 2 жыл бұрын
'You're waking up in 7 hours' lmaooo that hit different 😂😂
@ian3018
@ian3018 2 жыл бұрын
This was unbelievably helpful
@jgp6711
@jgp6711 6 ай бұрын
A great video illustrating a practical implementation around a Treeview. 👍
@dipitjaywant8044
@dipitjaywant8044 2 жыл бұрын
This was extremely helpful. Thanks for this video.
@VonSchelzen
@VonSchelzen 3 жыл бұрын
Congratulations, you are the best!
@logicalprogression9995
@logicalprogression9995 3 жыл бұрын
Don't leave comments very often but just saying nice one bro, exactly what I was looking for anyway! Nice to have actual explanations behind some of the functionality and parameter sets for a change.
@RamonWilliams
@RamonWilliams 3 жыл бұрын
much appreciated, just trying to help educate and save people some time :)
@tedtoad2471
@tedtoad2471 2 жыл бұрын
Excellent tutorial, thanks much. Still trying to figure out how to control the column widths otherwise it is all working great. Got it, in the column loop add tv1.column(column, width= 350)
@slickwillie3376
@slickwillie3376 2 жыл бұрын
Very educational. I modified it for accepting csv and txt files as well.
@coupdur7899
@coupdur7899 2 жыл бұрын
how did you do ? can i get the code please
@jeremyham764
@jeremyham764 3 жыл бұрын
Nice, clear and simple thx
@tomaszkubczyk2551
@tomaszkubczyk2551 3 жыл бұрын
You're a life saver. Cheers.
@RamonWilliams
@RamonWilliams 3 жыл бұрын
no problem
@ghaliahmed
@ghaliahmed 3 жыл бұрын
I want to thanks for this clean explanation ... 🇩🇿👍
@martin-xq7te
@martin-xq7te 2 жыл бұрын
Great tutorial. Thank you for keeping it simple. How about showing how to alter the df frame and return as excel file
@lapasta9925
@lapasta9925 3 жыл бұрын
thanks helped me much!
@sreerampillai1339
@sreerampillai1339 3 жыл бұрын
Awesome , really well explained!
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Glad it was helpful!
@canerucal
@canerucal 3 жыл бұрын
you saved my life. thank you very much !
@RamonWilliams
@RamonWilliams 3 жыл бұрын
You're welcome!
@aminegatou4492
@aminegatou4492 2 жыл бұрын
and now do a video about how to edit those values or add new values or delete values and automatically save it. It will help a lot
@ajayiomofayowa2258
@ajayiomofayowa2258 3 жыл бұрын
You are a life saver Jezz
@RamonWilliams
@RamonWilliams 3 жыл бұрын
no problem
@tribaldcon
@tribaldcon 3 жыл бұрын
Big thanks to you
@digitalmachine0101
@digitalmachine0101 4 ай бұрын
Good information
@vishnuvijay2959
@vishnuvijay2959 4 жыл бұрын
very nice!
@temitopecomfort2636
@temitopecomfort2636 2 жыл бұрын
Thank you for the tutorials. Please how do i create a filter dataframe from the load excel data and have it displayed on another window
@dwithidaya4168
@dwithidaya4168 3 жыл бұрын
Thank you so much..You saved me
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Happy to help
@alan6031
@alan6031 2 жыл бұрын
Thanks a lot for this! Very helpful. I have one question, how can I work with loaded excel/csv file, for example if I want to get the values from it and use them for any calculations? Even a little hint will help, thank you!
@TheSenseii915
@TheSenseii915 3 жыл бұрын
This was great, thank you. I was actually looking for a video that would show me how to allow a user to select an excel file and then have my program run pandas stuff on it and then return a new dataframe (that was modified as per the pandas stuff) and then save it wherever the user wanted to save it as an excel file. Do you have any content like that? Thank you.
@carlosngaba5721
@carlosngaba5721 Жыл бұрын
Hi. Thanks for the tutorial. I got a problem with the attribute yview and xview for treescrolly and treescrollx.
@majidzinkoohi330
@majidzinkoohi330 2 жыл бұрын
Hi Ramon Williams, Thanks a lot for this! Very helpful. I want to open multiple excel files and plot them. Tried to add some code but it didn't work. Can you help me please ?
@kiefah15
@kiefah15 3 жыл бұрын
This code helped me a lot. I just wanted to ask, how do I get rid of an additional "unnamed" column without hard coding it?
@idonotcomplyrevolution
@idonotcomplyrevolution 2 жыл бұрын
hi Ramon, im using gspread/pandas/numpy module and want to load a specific google sheet into a tkinter window, ive got it all working fine without tkinter/gui, any help would be dearly appreciated as ive been struggling on this for some weeks now as im a newbie python coder. best regards simon. also really enjoyed your tut and subbed.
@charlesdixon1950
@charlesdixon1950 2 жыл бұрын
I am getting some errors. No such file as (file_path) when i click load, so the try/except isnt working and the browse does not work probablt because of the initialdir. i didnt see this on yout github but ill look again
@alphinkj8351
@alphinkj8351 4 жыл бұрын
Thanks Ramson....I like your explanations also but i think if can reduce video length less than 7:59 minutes it will help you to increase your subscribers. Try to create tutorial videos. All the best for your KZbin journey.
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Thanks, looking back on this video i could've easily reduced it.
@Braha_19
@Braha_19 2 жыл бұрын
Great Explanation. But, when i try the treeview widget i receive an error stating "NULL main window". Copied your code from "Github". Can you help on this. TIA
@sirfsimran482
@sirfsimran482 3 жыл бұрын
Thanks Buddy for this awesome script :) Can you please add functionality in which user can select some format or style from drop down & fetch an excel report. But Nice Script Awesome :) :) :)
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Thanks Abhishek, I've created a tutorial recently that kind of extends on this script. It allows you to drag and drop csv files directly into the GUI. Which works better than a drop down in my option because a drop down would have to be hard coded i believe.
@graythistle
@graythistle 3 ай бұрын
nice! ... now how do you move items up, delete them, and insert new ones somewhere between two rows...
@gemorn
@gemorn 4 жыл бұрын
how to perform search opration on selected excel file plz make video on this topic
@RamonWilliams
@RamonWilliams 3 жыл бұрын
I will try to create a tutorial for that next week
@MrDogbural
@MrDogbural 3 жыл бұрын
If excel data cells have hyperlink, can we bring them into listbox and they can be clickable?
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Hi Minki, Yes this can definitely be done. I have only done this for a Treeview though. In my latest video "How to Bind to Widgets in Tkinter (Python GUI)" I show exactly how you can go about achieving this
@alwaaffa
@alwaaffa 3 жыл бұрын
how I can create GUI for search box or search engine to the dataset by using python?
@RamonWilliams
@RamonWilliams 3 жыл бұрын
I know this request is old but i will try to create a tutorial this week showing this
@user-hl9kq2tw7o
@user-hl9kq2tw7o 2 жыл бұрын
help somebody please, i got an error: 'Index' object is not callable
@dwithidaya4168
@dwithidaya4168 3 жыл бұрын
Can you please extend this program to plot a graph using the loaded excel file
@RamonWilliams
@RamonWilliams 3 жыл бұрын
This is actually quite easy to do. You can store the dataframe in memory each time is it loaded and have a button that plots the data based on an x and y variable you set
@keresnerezza23
@keresnerezza23 3 жыл бұрын
👍👍👍 Jesus christ u r awesome.thanks.
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Thank you
@gy9gy8
@gy9gy8 3 жыл бұрын
Hi,Could I just use tkinter load file data to python?
@PhoebeAshmore13
@PhoebeAshmore13 3 жыл бұрын
Hi - just seen no one has replied! I've just done a project that required data to be loaded in by the user. I used the filedialog module tkinter to get the file paths and then stored those in a variable. I then read the file in through pandas and stored it within the program as a dataframe. Hope that helps - I'm afraid I can't give exact code snippets because they're for a university assignment.
@johnjohnson4887
@johnjohnson4887 3 жыл бұрын
Thank you so much. But whenever I load the excel / csv file it shows me "The file you selected is not valid." Why is that. How can I fix it?
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Quick questions are you using the code in the video or the code in the github gist in the description? are you trying to load an excel file? if you are trying to load an excel file the code in the github gist should work. I missed out a few lines in this video that would enable it to work on excel files. therefore the code on this video only works on csv
@NeroNero-zo8gr
@NeroNero-zo8gr Жыл бұрын
​@@RamonWilliams 😢
@yannickbass5102
@yannickbass5102 3 жыл бұрын
I have copied the source code on github and ran it. I have a problem with tv.configure line it brings the following : invalid command name ".!labelframe.!treeview". Can you tell me what to do, please? Thanks for this video?
@RamonWilliams
@RamonWilliams 3 жыл бұрын
did you change the source in any way?
@RamonWilliams
@RamonWilliams 3 жыл бұрын
No problem Yannick, a few questions i have. What version of python are you using? Python 3 right? Are you getting the error as soon as you run the script or is it occuring when an excel file has already been loaded? I copied and pasted the source code myself and it worked fine. The error you have seems to occur when a widget is called after it has been destroyed and the only thing that destroyed here is the children of the treeview
@enosjonathanraharja5133
@enosjonathanraharja5133 3 жыл бұрын
can this works with csv files?
@slickwillie3376
@slickwillie3376 2 жыл бұрын
You'll need to do some modification. Took me about an hour to figure it out, but works great now with csv, txt, and xlsx file extensions. Use the If file_path.split(".")[-1] == "csv": statement (same for .txt extension) and make the assignments in the load_file function conditional. Good luck!
@naxishah7493
@naxishah7493 3 жыл бұрын
how can I solve error like "unsupported format : Expected BOF record"
@RamonWilliams
@RamonWilliams 3 жыл бұрын
If you tried to read in a csv file you would've got that error as i forgot to account for csv files in this videos code. However the code in the GitHub Gist in the description works for csv files.
@plaine3308
@plaine3308 3 жыл бұрын
How can I edit the code so that it always opens a specific file of my choice
@RamonWilliams
@RamonWilliams 3 жыл бұрын
Hi Plaine, You could remove the file dialog function and the "Browse a file" button. and then you could either make label or filepath variable (inside the load excel data function) equal to the path of your specific file
@plaine3308
@plaine3308 3 жыл бұрын
@@RamonWilliams Thank you
How To Get Stock Prices in C# From AlphaVantage: Method 1
9:58
Ramon Williams
Рет қаралды 8 М.
Create Stunning Python GUIs in 10 Minutes With Drag & Drop
11:38
Coding Is Fun
Рет қаралды 42 М.
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 12 МЛН
Treeview - Python Tkinter GUI Tutorial #116
20:21
Codemy.com
Рет қаралды 136 М.
25 Nooby Pandas Coding Mistakes You Should NEVER make.
11:30
Rob Mulla
Рет қаралды 265 М.
Using tkinter with classes
28:23
Atlas
Рет қаралды 58 М.
Python GUI Development With PySimpleGUI
15:15
Real Python
Рет қаралды 1 МЛН
Open Excel Spreadsheets In Treeview - Tkinter Projects 3
17:21
Tkinter․com
Рет қаралды 21 М.
Python GUI open a file (filedialog) 📁
7:38
Bro Code
Рет қаралды 95 М.