pandasgui tutorial














































pandasgui tutorial




what is pandasgui?


  pandasgui is a GUI-Graphical User Interface that helps in visualising a given pandas DataFrame.(A pandas DataFrame can be obtained from an input dataset).

using pandasgui one can perform many tasks such as statistical analysis, querying a dataframe i.e applying filters to a DataFrame, plotting various types of graphs(line,, box,bar, histogram, etc), reshaping the DataFrame and other tasks too

As like many other GUI it has also drag and drop feature.

It can be run from a python script or python IDLE or a terminal or an IDE.

In this article I will be using python IDLE only.


InstallaiNg pandasgui:

open your operating system's terminal and type 

 pip install pandasgui 

This should download the pandasgui on to your workspace and all it's dependencies.

Usage:

On typing the below code the GUI window of pandasgui will open up.




Here the DataFrame tab shows the pandas DataFrame similar to how a jupyter notebook would show it.
The values in the DataFrame can also be edited.
This is an important feature as otherwise we would have to write code for it.

We can also copy our dataset on to a notepad.

The filter tab can be used to filter or query the DataFrame as per the need of the user.
For example here I have use A>5 as a query.
.



 

Now the DataFrame tab will show only those rows which have values of variables in column A are greater than 5.



The Statistics tab will show the statistical analysis of the DataFrame at all times.

It would include values like mean, standard deviation, etc.

While using pandas we have to write code for each one of these but pandasgui would show it at all times.




The grapher tab is built over plotly library of python.

Grapher tab has many plotting options as shown below.

In the tab below it has options for other arguments or inputs for the graphs in the "Name" section.

Here I plotted a line graph depicting how values of A, B, C would change with respect to D.



The reshaper tab is used to create a new "reshaped" DataFrame.

It doesn't remove the current DataFrame.

The reshaper tab has two options like pivot and melt.

We will understand them in more detail with the following example.


Working with a real Dataset: 


Here we will use "pokemon" dataset that comes built in with pandasgui,
This dataset has all the info about pokemons like their HP,Attacks<type,etc.

Code for using inbuilt-dataset :

   From pandasgui.datasets import pokemon
   show(pokemon)

here "pokemon" is already a pandas DataFrame but for a new dataset file we would have to convert it using pandas library.

One more feature of pandasgui is that clicking on any of the columns would sort the values in the DataFrame as per that column in ascending order and clicking again would sort it in descending order.
Here I have sorted the dataset as per "Generation " Column.
 



Using filter tab we can query results as per our need.
here I used a query "Attack>150" to get only those rows with value of attack greater than 150.



Using grapher tab I plotted a line graph for pokemons with attack greater than 150 to get a relation between values of special defense and Speed.



Here we can see that if the speed of a pokemon is beyond 120 it's value of sp.defense decreases steeply.

Reshaper tab can be used to reshape a given dataframe.

Here using the pivot method I created a reshaped copy of the DataFrame with "#" column as the index.
  

 
The newly created DataFrame should look like this.
This pivoted DataFrame will depend on the snapshot of the original Dataframe at the time of making the new one.
So this includes only those rows which had Attack>150.

 

Another method is melt method which is a more simpler and novice one.

It takes two arguments "id_vars" and "value_vars".
As can be seen in the "Names" tab below.


The resulting DataFrame would look like this.






More Articles of Mohta Rahul Suresh:

Name Views Likes
How to kill a thread in python - part 1 875 0
IMAGE PROCESSING FROM SCRATCH USIGN PIL AND OPENCV SERIES : PART 3 538 0
Automated testing and implementing unit testing using python 896 0
Searching algorithms in RUST Part 1 686 0
Check validity of Email address using SMTP and dnspython library. 3940 0
Blocking and non-blocking threads in python - Simplified 6699 0
IMAGE PROCESSING FROM SCRATCH USIGN PIL AND OPENCV SERIES : PART 7 492 0
How to run C and C++ on Google Colab. 46721 1
Create a telegram bot to get notifications about price of your favourite Cryptocurrency (using Python) 2187 1
Image processing from Scratch usign PIL and OpenCV Series : Part 1 393 0
Searching Algorithms in RUST part 2 317 0
Make a QR-code with your Face on it. 2110 0
RUST CHEATSHEET Part 2 452 0
How to kill a thread in python - part 2 671 0
Hiding an Image inside another Image - Steganography using python. 3222 0
RUST CHEAT SHEET part 1 569 0
PyPy installation, usage and speed comparison with CPython 753 0
IMAGE PROCESSING FROM SCRATCH USIGN PIL AND OPENCV SERIES : PART 6 281 0
Convert text in an image to an audio file using tesseract and gTTS in python. 1825 0
IMAGE PROCESSING FROM SCRATCH USIGN PIL AND OPENCV SERIES : PART 5 344 0
IMAGE PROCESSING FROM SCRATCH USIGN PIL AND OPENCV SERIES : PART 4 305 0
Convert a CSV file to a table in a markdown file 4141 0
pandasgui tutorial 1074 3
IMAGE PROCESSING FROM SCRATCH USIGN PIL AND OPENCV SERIES : PART 2 396 0
Algorithmic trading basics with google stocks using python. 857 0

Comments