Category : Step By Step Python Training Tutorial

BySlide Scope

Maths Module in Python Language

How to Import Maths Module in Python

Maths module is already included with python installation.

To import any module in your program you must use:

import <modulename>

To import Math module write:

>>>import math


>>> print(pi)

NameError: name ‘pi’ is not defined

>>> import math

>>> print(math.pi)


>>> print(pi)

NameError: name ‘pi’ is not defined

We must use math. before calling any method or variable of math module.

>>> math.factorial(5) # To calculate factorial


>>> math.e


BySlide Scope

How to plot Boxplot in Python

A box plot is used to visualize 5 values in a dataset for the selected column(s):

  • Minimum Value
  • First Quartile or 25%
  • Median (Second Quartile) or 50%
  • Third Quartile or 75%
  • Maximum value

Box Plot is also known as Box and Whisker Plot.

Steps –

    1. Load the dataset using Pandas dataframe
  1. Select any column to visualize
  2. Plot boxplot using Pandas
  3. Plot boxplot using Seaborn

Python Code :

import pandas as pd

#load data

data = pd.read_csv(‘insurance.csv’)


how to plot boxplot in pandas

>> data.describe()

statistics in python pandas

# In pandas boxplot one attribute, column is required to plot boxplot
# Column can take name of one column of the dataset or the list of columns

# We can group data as well.

data.boxplot(column=[‘age’], by=[‘gender’], figsize=[10,7])

Boxplot Using Seaborn Library