# What Is The Difference Between Normal And Binomial Distribution

• What is Normal Distribution?
• What is Binomial Distribution?
• Difference between Normal Distribution and Binomial Distribution.
• The Chart Comparision between Normal Distribution and Binomial Distribution.

## What is Normal Distribution?

A Normal Distribution which is also known as the Gaussian distribution is a probability distribution, illustrating that the data near the mean is more frequent in occurrence than the data which is far. Normal distributions are symmetrical but not all symmetrical distributions are normal. In Normal Distribution the mean, mode, and median are equal, and the curve is symmetric at the center. The total area under the curve is 1.

``````import numpy as np
import matplotlib.pyplot as plt

# Creating a series of data of in range of 1-200.
x = np.linspace(1,200,400)``````
``````#Creating a Function.
def normal_dist(x , mean , sd):
prob_density = (np.pi*sd) * np.exp(-0.5*((x-mean)/sd)**2)
return prob_density

#Calculate mean and Standard deviation.
mean = np.mean(x)
sd = np.std(x)

#Apply function to the data.
pdf = normal_dist(x,mean,sd)``````
``````#Plotting the Results
plt.plot(x,pdf , color = 'green')
plt.xlabel('The Data Points')
plt.ylabel('Probability [ Density ]')``````

The full code for Normal Distribution:

``````import numpy as np
import matplotlib.pyplot as plt

# Creating a series of data of in range of 1-200.
x = np.linspace(1,200,400)

#Creating a Function.
def normal_dist(x , mean , sd):
prob_density = (np.pi*sd) * np.exp(-0.5*((x-mean)/sd)**2)
return prob_density

#Calculate mean and Standard deviation.
mean = np.mean(x)
sd = np.std(x)

#Apply function to the data.
pdf = normal_dist(x,mean,sd)

#Plotting the Results
plt.plot(x,pdf , color = 'green')
plt.xlabel('The Data Points')
plt.ylabel('Probability [ Density ]')``````

Output

## What is Binomial Distribution?

The Binomial Distribution brings the likelihood that a value will take one of two independent values under a given set of assumptions. Binomial Distribution is a discrete distribution, that describes the outcome of binary scenarios.

``````
from scipy.stats import binom
import seaborn as sb

binom.rvs(size=10,n=20,p=0.8)``````
``````data_binom = binom.rvs(n=20,p=0.8,loc=0,size=1000)
ax = sb.distplot(data_binom,
kde=True,
color='blue',
hist_kws={"linewidth": 25,'alpha':1})
ax.set(xlabel='Binomial', ylabel='Frequency')	``````

The full code for Binomial Distribution:

``````from scipy.stats import binom
import seaborn as sb

binom.rvs(size=10,n=20,p=0.8)

data_binom = binom.rvs(n=20,p=0.8,loc=0,size=1000)
ax = sb.distplot(data_binom,
kde=True,
color='blue',
hist_kws={"linewidth": 25,'alpha':1})
ax.set(xlabel='Binomial', ylabel='Frequency')
``````

The Output

## Difference between Normal Distribution and Binomial Distribution

``````from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns

sns.distplot(random.normal(loc=50, scale=5, size=1000),  label='normal')
sns.distplot(random.binomial(n=100, p=0.5, size=1000),  label='binomial')
plt.legend()
plt.show()``````

The Output

## The Chart Comparision between Normal Distribution and Binomial Distribution  