import numpy as np
from scipy import stats
custm = stats.rv_discrete(name='custm', values=((1, 2, 3), (1.0 / 3, 1.0 / 
    3, 1.0 / 3)))
custm.cdf(2.5)
Python scipy - specify custom discrete distribution