Skip to main content

Pareto Distribution in Python

In this tutorial you will learn:

  • What is Pareto Distribution?
  • Pareto Distribution Implementation in python
  • Visualization of Pareto Distribution

Pareto Distribution

Pareto Distribution is a continuous power law distribution named after the famous 19th Century economist named Vilfredo Preto. Pareto Distribution is also known as Zipf distribution and as Riemann zeta distribution. It is commonly referred as Pareto Principle, “80-20” rule or Mathew Principle. An example for “80-20” rule could be the wealth distribution, that the 80% of wealth is held by 20% of the Italian population(statistics of 20th Century) .The pareto distribution can be used in variety of situations, as an example it could be used to model the life time of manufactured item with certain warranty period. Practical applications of Pareto Distribution includes business management, evaluation of company revenue sources, employee evaluation etc.

Pareto Distribution in Python

The random module of python’s NumPy library provide an inbuilt function pareto() for implementation of Pareto Distribution. The pareto() function takes in two mandatory parameters, first parameter is the “size” of the array which we require as an output.The second parameter “a” is the shape perimeter called as slope parameter or pareto index. The value of shape perimeter could be an unsigned float or int only.
In order to enhance the understanding of Pareto Distribution, lets take an example. We will generate a 1D array(10,) of Pareto distribution with shape perimeter 2. In this code we can see that we are importing the random module in the second line of the code and in the fourth line we are applying the Pareto distribution with output size parameter (10,) and shape parameter ‘a’ equal to 2.

  1. #importing the random module
  2. from numpy import random
  3. #applying the Pareto function
  4. res_arr= random.pareto(size=10,a=2.0)
  5. #printing the results
  6. print('1D array of size 10 having Pareto distribution with slope parameter 2 :\n')
  7. print(res_arr)

Lets take another example, in this example we will generate a 2D array of Pareto distribution having size (3,4) with value of shape parameter equal to 0.5.
  1. #importing the random module
  2. from numpy import random
  3. #here we are using Pareto function to generate Pareto distribution of size 3 x 4 with shape parameter 0.5
  4. res_arr = random.pareto(size=(3,4),a=0.5)
  5. print('2D Pareto Distribution as output from Pareto() function:\n')
  6. #printing the result
  7. print(res_arr)

In this example we will generate a 3D array of Pareto distribution of the size(7,8,9) with slope parameter equal to 1.
  1. #importing the random module
  2. from numpy import random
  3. #here we are using Pareto function to generate Pareto distribution of size 7 x 8 x 9
  4. res = random.pareto(size=(7,8,9), a=1)
  5. print('3D Pareto Distribution as output from pareto() function:\n')
  6. #printing the result
  7. print(res)

Visualization of Pareto Distribution

In this example we will visualize the Pareto Distribution with slope parameter 1.5. Here we will be using the displot function of seaborn library to plot and visualize a two dimensional pareto distribution

  1. #importing all the required modules and packages
  2. from numpy import random
  3. import matplotlib.pyplot as mpl
  4. import seaborn as sb
  5. #here we are using Pareto function to generate distributions of size (1000,2) with slope parameter 1.5
  6. sb.distplot(random.pareto(size=(1000,2),a=1.5), hist=False, label='Pareto Distribution')
  7. #plotting the graph


Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.