how to make a distribution function of the data in pytho code example

Example 1: cdf empírica python

# example of a bimodal data sample
from matplotlib import pyplot
from numpy.random import normal
from numpy import hstack
# generate a sample
sample1 = normal(loc=20, scale=5, size=300)
sample2 = normal(loc=40, scale=5, size=700)
sample = hstack((sample1, sample2))
# plot the histogram
pyplot.hist(sample, bins=50)
pyplot.show()

Example 2: cdf empírica python

P(x<20): 0.149
P(x<40): 0.654
P(x<60): 1.000