Poisson Distribution in NumPy Last Updated : 22 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The Poisson Distribution model the number of times an event happens within a fixed time or space when we know the average number of occurrences. It is used for events that occur independently such as customer arrivals at a store, Website clicks where events happen independently.numpy.random.poisson() MethodIn Python'sNumPylibrary we can generate random numbers following a Poisson Distribution using the numpy.random.poisson() method. It has two key parameters:lam : The average number of events (λ) expected to occur in the interval.size : The shape of the returned array.Syntax:numpy.random.poisson(lam=1.0, size=None)Example 1: Generate a Single Random NumberTo generate a single random number from a Poisson Distribution with an average rate of λ = 5: Python import numpy as np random_number = np.random.poisson(lam=5) print(random_number) Output :5Example 2: Generate an Array of Random NumbersTo generate multiple random numbers: Python random_numbers = np.random.poisson(lam=5, size=5) print(random_numbers) Output :[13 6 4 4 10]Visualizing the Poisson DistributionTo understand the distribution better we can visualize the generated numbers. Here is an example of plotting a histogram of random numbers generated using numpy.random.poisson. Python import numpy as np from numpy import random import matplotlib.pyplot as plt import seaborn as sns lam = 2 size = 1000 data = random.poisson(lam=lam, size=size) sns.displot(data, kde=False, bins=np.arange(-0.5, max(data)+1.5, 1), color='skyblue', edgecolor='black') plt.title(f"Poisson Distribution (λ={lam})") plt.xlabel("Number of Events") plt.ylabel("Frequency") plt.grid(True) plt.show() Output:Poisson DistributionThe image shows a Poisson Distribution with λ=2 displaying the frequency of events. The histogram represents simulated data highlighting the peak at 0 and 1 events, with frequencies decreasing as the number of events increases. Comment More infoAdvertise with us Next Article Poisson Distribution in NumPy J Jitender_1998 Follow Improve Article Tags : Python Python-numpy Python numpy-Random Practice Tags : python Similar Reads Uniform Distribution in NumPy A Uniform Distribution is used when all the numbers in a range have the same chance of being picked. For example, if we choose a number between 10 and 20 and every number in that range is just as likely as any other. In Python's NumPy library you can generate random numbers following a Uniform Distr 2 min read Chi-Square Distribution in NumPy The Chi-Square Distribution is used in statistics when we add up the squares of independent random numbers that follow a standard normal distribution. It is used in hypothesis testing to check whether observed data fits a particular distribution or not. In Python you can use the numpy.random.chisqua 2 min read Normal Distribution in NumPy The Normal Distribution also known as the Gaussian Distribution is one of the most important distributions in statistics and data science. It is widely used to model real-world phenomena such as IQ scores, heart rates, test results and many other naturally occurring events.numpy.random.normal() Meth 2 min read Binomial Distribution in NumPy The Binomial Distribution is a fundamental concept in probability and statistics. It models the number of successes in a fixed number of independent trials where each trial has only two possible outcomes: success or failure. This distribution is widely used in scenarios like coin flips, quality cont 2 min read Python - Moyal Distribution in Statistics scipy.stats.moyal() is a Moyal continuous random variable. It is inherited from the of generic methods as an instance of the rv_continuous class. It completes the methods with details specific for this particular distribution. Parameters : q : lower and upper tail probability x : quantiles loc : [op 2 min read Like