Tkinter GUI tutorial python – how to clean excel data

Tkinter is an application within Python that allows users to create GUI or graphical user interfaces to manage data in a more user-friendly way.

We have tested this code over 100,000 records sitting on the Microsoft OneDrive network so in a way, its speeds were quite good, over five tests, they all were under 100s from start to finish.

data cleansing data cleansing fixed

In this Tkinter GUI tutorial python, you will be shown how to find the data errors, clean them and then export the final result to excel.

We will take you through the following:

  • Creation of the Tkinter interface.
  • Methods/ functions to find errors.
  • Methods/functions to clean the data.
  • Exporting the clean data to an excel file.

The video walks through the creation of a Tkinter window using a canvas and a frame to store the data frame.

Then it looks at importing the data through pd.read_excel, to load the data into a pandas data frame.

Next, there is a function and or method that will extract the errors through str.extract , which is loaded into separate columns

Finally, I have exported the clean dataset using rawdata.to_excel , and saved the file as a separate new spreadsheet.

 

how to pass data between functions

In this python program, we are learning how to pass data between functions, a tool that will become very handy especially when you are trying to automate certain tasks that are repetitive.

Functions serve a number of benefits:

  • You can pass a number of arguments to them to be processed.
  • They are easily identified by using the def keyword in your code.
  • a return statement can give you the output of the function to show on the screen or pass to another function.

It compliments r-tutorial-how-to-pass-data-between-functions/  and can be seen that this handy bit of functionality is used widely across many different programming languages.

Below is a video that will help to give an understanding of how to pass data between functions when trying to learn python:

 

In many of the Data Analytics Ireland    YouTube channel videos, there is an emphasis on creating content that eliminates duplication of code within the code. We have also started incorporating classes as well and you can see here How to create a class in Python , a tutorial on how to create one.

Classes by their nature have methods, which are called on the objects that created them ( the class), and can alter their state, whereas a function will run and just return a value.

It is important to understand the distinction as while the two will most likely achieve the same outcome, it is the ability to change the class state that will differentiate the two.