Let's say I have a list of random variables, and I use the histogram function like this:
import numpy as np
x = [np.random.randn() for i in range(2**10)]
vals, bin_edges = np.histogram(x, 100)
1) How do I efficiently normalize this histogram to become a list representations of a probability mass function?
2) How do I map from this probability mass function to a new list in such a way that I end up with a list where the value at i
corresponds to the probability of observing x[i]
?