A box plot consists of 5 things.
- minimal
- First quartile or 25%
- Median (second quartile) or 50%
- Third quartile or 75%
- maximum
To load the dataset in use, click here .
Draw a plot frame with pandas:
One way to plot a boxplot using pandas Conspiracy # import the desired library
import
numpy as np
import
pandas as pd
import
matplotlib.pyplot as plt
%
matplotlib inline
# load dataset
df
=
pd.read_csv (
"tips.csv"
)
# display 5 rows of dataset
df.head ()
days
subject to total_bill
.
|
Boxplot by size
best regards tip
.
|
Draw a box using the 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
hu e = feature of dataset
data = datafram or full dataset
color = color name
Let’s see how to create a boxed plot using the Seaborn library.
Information about a set of "hints."
|
Plot days
with total_bill
.
|
Let’s take the first rectangle-method/">rectangle, that is, the blue rectangle-method/">rectangle plot of the shape, and figure out the following statistical things:
- Bottom black horizontal plot line blue rectangle-method/">rectangle is the minimum value
- First black horizontal rectangular line on the blue rectangle-method/">rectangle chart — First quartile or 25%
- Second black rectangular horizontal line in the blue rectangle-method/">rectangle plot represents the Second quartile or 50% or median.
- The third black horizontal rectangular line of the blue rectangle-method/">rectangle represents the third quartile or 75%
- The maximum value of the top black horizontal line of the rectangle-method/">rectangle in the blue border
- Small diamond shapes in the blue rectangle-method/">rectangle plot represent outliers or erroneous data.