# Category : Step By Step Python Training Tutorial

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

Example

>>> print(pi)

NameError: name ‘pi’ is not defined

>>> import math

>>> print(math.pi)

3.141592653589793

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

120

>>> math.e

2.718281828459045

### 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
OR
3. Plot boxplot using Seaborn

Python Code :

import pandas as pd >> data.describe() # 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
data.boxplot(column=[‘age’],figsize=[10,7]) # We can group data as well.

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