python probability density function

Asked

Viewed 47 times

0

I can’t create a continuous probability density function for a random variable to plot it over the histogram.

val = df[['posição', 'num']].groupby('num').agg(lambda x: list(set(x))).reset_index()
cont = 0
fprob=[]
for i in val.index:
    cont += len(val.query('index=={}'.format(i))
    fprob.append(len(val.query('index=={}'.format(i))/(cont*(len(df)/len(var)))

That’s what I tried, where the val keeps the positions where the value one repeats within df. Then I tried to search for each value how many times it repeats and divide it by the amount of values that have already been tested times the proportion that each value represents of df. I don’t know any function that already provides me the probability density function, so I tried it like this.

  • any density function has defined functional form. Which function do you want? Normal, Poisson, binomial?

  • So, it’s from a dataframe with a distribution that I n know what the form is

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.