Boxplot Grouping: Visualizing one variable based on another variable using boxplot

Home » News » Boxplot Grouping: Visualizing one variable based on another variable using boxplot
Boxplots are mainly used to visualize the distribution of the data in different variables in a dataset. We can easily predict outliers by drawing a boxplot for a variable. We can also group the results based on the another variable in the dataset. Lets see how?

Consider a Load Prediction dataset. We will analyze ApplicantIncome and Education variables in this dataset.

Step 1: Import the required libraries

import pandas as pd
import numpy as np
import matplotlib as plt
%matplotlib inline
import seaborn as sns

Step 2: Load the dataset

dataset = pd.read_csv(“C:/train_loan_prediction.csv”)

Step 3: Draw boxplot for ApplicantIncome

dataset.boxplot(column='ApplicantIncome')

We can see a lot of outliers/extreme values in the applicant income column. From this, we can conclude that there is a lot of income disparity in the society. But hold on, we are analyzing income of all the people by disregarding their education levels which is practically not right. There is a good probability that educated people will be having higher income as compared to the uneducated / less educated people. Lets segregate the income by education:


dataset.boxplot(column='ApplicantIncome', by = ‘Education')


We can see that there is no substantial different between the mean income of graduate and non-graduates. But there are higher number of graduates with very high incomes, which are appearing to be the outliers.

Leave a Reply

Your email address will not be published. Required fields are marked *

New Providers
Binolla

The Broker
More then 2 million businesses
See Top 10 Broker

gamehag

Online game
More then 2 million businesses
See Top 10 Free Online Games

New Games
Lies of P

$59.99 Standard Edition
28% Save Discounts
See Top 10 Provider Games

COCOON

$24.99 Standard Edition
28% Save Discounts
See Top 10 Provider Games

New Offers
Commission up to $1850 for active user of affiliate program By Exness

Top Points © Copyright 2023 | By Topoin.com Media LLC.
Topoin.info is a site for reviewing the best and most trusted products, bonus, offers, business service providers and companies of all time.

Discover more from Top Points

Subscribe now to keep reading and get access to the full archive.

Continue reading