A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/data-visualization/box-plot-visualization-with-pandas-and-seaborn/ below:

Box plot visualization with Pandas and Seaborn

Box plot visualization with Pandas and Seaborn

Last Updated : 11 Jul, 2025

Box Plot

is the visual representation of the depicting groups of numerical data through their quartiles. Boxplot is also used for detect the outlier in data set. It captures the summary of the data efficiently with a simple box and whiskers and allows us to compare easily across groups. Boxplot summarizes a sample data using 25th, 50th and 75th percentiles. These percentiles are also known as the lower quartile, median and upper quartile. A box plot consist of 5 things.

To download the dataset used, click

here

.

Draw the box plot with Pandas:

One way to plot boxplot using pandas

dataframe

is to use

boxplot()

function that is part of pandas library.

Python3
# import the required library 
import numpy as np 
import pandas as pd 
import matplotlib.pyplot as plt 
% matplotlib inline


# load the dataset
df = pd.read_csv("tips.csv")

# display 5 rows of dataset
df.head()   

Boxplot of

days

with respect

total_bill

.

Python3
df.boxplot(by ='day', column =['total_bill'], grid = False)

Boxplot of

size

with respect

tip

.

Python3
df.boxplot(by ='size', column =['tip'], grid = False)
  Draw the boxplot using seaborn library:
Syntax : seaborn.boxplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, width=0.8, dodge=True, fliersize=5, linewidth=None, whis=1.5, notch=False, ax=None, **kwargs) Parameters: x = feature of dataset y = feature of dataset hue = feature of dataset data = dataframe or full dataset color = color name

Let's see how to create the box plot through seaborn library. Information about "tips" dataset.

Python3
# load the dataset
tips = sns.load_dataset('tips')

tips.head()

Boxplot of

days

with respect

total_bill

.

Python3
# Draw a vertical boxplot grouped 
# by a categorical variable:
sns.set_style("whitegrid")

sns.boxplot(x = 'day', y = 'total_bill', data = tips)

Let's take the first box plot i.e,

blue box plot

of the figure and understand these statistical things:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4