Skip to main content

How to Transform A Continuous Distribution into a Discrete One Using Pandas/Matplotlib/Numpy

import pandas as pd
from matplotlib import pyplot as plt
import numpy as np
from scipy import stats
from math import sqrt
from math import comb
from scipy.stats import binom

x = np.arange(0, 40, 0.01) 

y2 = stats.norm.pdf(x, mean, std)

I have this continuous probability distribution. I want to transform it into a discrete one. How can I do this? I tried pd.cut and pd.qcut but neither seem to work.



source https://stackoverflow.com/questions/74082484/how-to-transform-a-continuous-distribution-into-a-discrete-one-using-pandas-matp

Comments