Python GUI (Tkinter) Tutorial: CSV/DataFrame Viewer - Part 7 Finale - Search/Filter Custom Treeview

preview_player
Показать описание
This is part 7 to my tutorial series on how to create a Desktop Application in Python using the tkinter and TkinterDnD libraries. The application we are creating is a CSV/DataFrame Viewer.

Programming Language: Python 3.7
Text Editor: Pycharm
Libraries: TkinterDnD2, TkinterDnD, TKinter, Pandas, Pathlib

What people search to find this video:
Python, self taught, tkinter, desktop application, pycharm, OOP, object oriented programming, View CSV, Custom Widgets, TkinterDnD
Рекомендации по теме
Комментарии
Автор

Thank you for this great tutorial!
I had two problems after running the code.
When i double clicked the dropped file i had a utf-8 decode error.
My solution for this:
I added this to your code in line 95:
df = pd.read_csv(path, encoding='cp1252', delimiter=';')

Second problem, the code was breaking when in the column_value pairs. There were NaN values in the csv data.
Solution for this was adding some code to line 54:
query_string = f"{col}.str.contains('{value}', na=False)"
This solved this problem!

benb
Автор

Thank you for your superb efforts. I had fun and learned a lot. Yes, there were problems. Some in your code, some in my following along. But solving hiccups is where the learning lies. If you had provided a flawless copy-and-paste text, and I had gotten lazy in following, I would have learned far less. And you provided a foundation so I will try to expand and add additional functionality for my project. I'm subscribed now. Cheers!

ajkurp
Автор

Thanks for the series. It was fun to follow!

bhatmagic
Автор

how are you coping the csv file to the viewer.? im doing a cntrl-c to copy and cntrl-v to paste but nothing is happening. i see you half to drag the file over to the grey box

rverm
Автор

hi friend i left some comment in your git...
it seems that there are some bugs in function : search_table
(1)the name of the column can not contain space, like "AA BBB" will throw error
(2)if there is #N/A in a column, it will throw error
(3)if the column only contain number instead of str, it will throw error
the errors i got :
AttributeError: Can only use .str accessor with string values!
ValueError: Cannot mask with non-boolean array containing NA / NaN values

XiaoleiHuang-ob
Автор

line 91 has an error, _tkinter.TclError: bad listbox index "": must be active, anchor, end, @x, y, or a number

rverm
Автор

Program only accepts headers with one word. Cant figure out how to use the filter with headers of more than one word

gustavobordapoo