Can continuous random variables be converted into discrete using scipy?

Viewed 1295

If I initialize a subclass of scipy.stats.rv_continuous , for example scipy.stats.norm

>>> from scipy.stats import norm
>>> rv = norm()

Can I convert it into a list of probabilities with each element representing the probability of a range of values after providing the number of ranges? Something like - (for the range - [(-inf,-1), (-1,0), (0,1), (1, inf)] )

>>> li
[0.15865525393145707, 0.34134474606854293, 0.34134474606854293, 0.15865525393145707]

( where 0.15865525393145707 is the probability of the variable being less than -1 and 0.34134474606854293 for being in the range -1 to 0 and similarly for others.

Can this be done using scipy? If not which python library can support such conversion operations?

1 Answers
Related