How to generate normally distributed data in Python

1 min

Python comes in handy when you want to generate data.

Using the NumPy library you will be able to generate data based on various distributions.

Here is an example of data generated using a normal distribution using the numpy.random.normal():

# We import numpy
import numpy as np

# We define our variables in order to generate data
mu = 0
std = 1
n = 10

# Normally distributed list
list_of_normally_distributed_obs = np.random.normal(mu, std, n)

Here you are! You now know how to generate normally distributed data in Python!

More on fundamentals

If you want to know more about Python fundamentals without headaches... check out the other articles I wrote by clicking just here:

Fundamentals - The Python You Need
We gathered the only Python essentials that you will probably ever need.