Plot visualization with pandas and siborn



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

# 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 () 

Conspiracy days subject to total_bill .

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

Boxplot by size best regards tip .

df.boxplot (by = `size` , column = [ ` tip` ], grid = False )

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.”

# load dataset

tips = sns.load_dataset ( `tips` )

  
tips.head ()

Plot days with total_bill .

# Draw a vertical checkpoint grouped
# by categorical variable:

sns .set_style ( "whitegrid" )

  

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

Let`s take the first rectangle, that is, the blue rectangle plot of the shape, and figure out the following statistical things:

  • Bottom black horizontal plot line blue rectangle is the minimum value
  • First black horizontal rectangular line on the blue rectangle chart — First quartile or 25%
  • Second black rectangular horizontal line in the blue rectangle plot represents the Second quartile or 50% or median.
  • The third black horizontal rectangular line of the blue rectangle represents the third quartile or 75%
  • The maximum value of the top black horizontal line of the rectangle in the blue border
  • Small diamond shapes in the blue rectangle plot represent outliers or erroneous data.