Lets visualize our data with Distribution Plot which is present in Seaborn library. By default distribution plot shows histograms. We will create 150 random numbers and plot them on distribution plot. We can pass various parameters to distplot like color, hist, rug, bins, vertical etc. Lets explore distplot in detail:

import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

#matplotlib inline

num = np.random.randn(150)

num

Please note that I am not displaying the resulting plots in this post. Please explore it yourself in your Jupyter notebook.

sns.distplot(num)

sns.distplot(num,

label_dist = pd.

sns.distplot(label_dist)

sns.distplot(label_dist,

sns.distplot(label_dist,

sns.distplot(label_dist,

sns.distplot(label_dist,

**Step 1: Import required libraries****import numpy as np**

import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

#matplotlib inline

**Step 2: Create 150 random numbers**num = np.random.randn(150)

num

**Step 3: Explore data using Distribution Plot**Please note that I am not displaying the resulting plots in this post. Please explore it yourself in your Jupyter notebook.

sns.distplot(num,

**color**='red')label_dist = pd.

**Series**(num, name="variable x") #convert random numbers into pandas seriessns.distplot(label_dist)

sns.distplot(label_dist,

**vertical**=True) #vertical histogramsns.distplot(label_dist,

**hist**=False) #remove histogram from distribution plotsns.distplot(label_dist,

**hist**=False,**rug**=True) #specify rug parametersns.distplot(label_dist,

**bins**=20) #specify number of bins you want to create
## No comments:

## Post a Comment