Uniform Distribution Use uniform.rvs and assign its output to the variable samples. In this function, specify the location (loc) parameter to be 100, set the scale to be 20, and the sample size to be 1000 and generate histogram.
using pandas, python
Uniform Distribution
Use uniform.rvs and assign its output to the variable samples. In this function, specify the location (loc) parameter to be 100, set the scale to be 20, and the sample size to be 1000 and generate histogram.


Using python:
Import packages:
# import uniform distribution
from scipy.stats import uniform
import numpy as np
# import seaborn
import seaborn as sns
# settings for seaborn plotting style
sns.set(color_codes=True)
# settings for seaborn plot sizes
sns.set(rc={'figure.figsize':(5,5)})
uniform function generate uniform continuous variable between the specified interval through its loc and scale arguments.
samples=uniform.rvs(loc=100,scale=20,size=1000)
assert len(samples)==1000
assert isinstance(samples, np.ndarray)
use Seaborn’s distplot to plot the histogram of the distribution:
ax = sns.distplot(samples,
bins=100,
kde=True,
color='skyblue',
hist_kws={"linewidth": 15,'alpha':1})
ax.set(xlabel='Uniform Distribution ', ylabel='Frequency')
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









