How to get cumulative distribution function from discrete numbers in python

226 views Asked by At

I'm new to this topic, this question may be dumb. I did some experiments, results and their occurrence are list below. I need to convert these discrete numbers into probability distribution and cumulative distribution (x axis is results and y-axis is probability).

import pandas as pd

data = {'Result': [1, 2, 4, 6],
        'Occurrence': [2,3,4,1],
        'Probability':[0.2,0.3,0.4,0.1]}

df= pd.DataFrame(data)

Then find the x corresponding to different probability level in cumulative distribution. Say 50%, 60%, 80% etc.

I did some research, but cannot find the right python package or function to achieve this. Package or function name should be good and an examples will be great. Thanks.

1

There are 1 answers

1
TheCableGUI On

Working with conditional distributions or probability distributions and cumulative distributions, you are going to have to use three different programming styles... lambda, functional and object orient to represent conditional , probability and cumulative statistics.

Much like statistical maths, computational maths vary significantly in the scope of knowledge.

for cumulative distributions it would seem necessary that you use lambda functions to represent the data.

Lambda functions allow you to create expressions for relationships.

Functions are just the sum of the steps that make two objects related, or perhaps the sum of conditions that make up a codomain....

You will need to use lambda functions to create anonymous functions to represent possible relationships while you deal with the x and y, let Lambda represent the function definition in our case.


y = codomain
x = domain
f(x) = lamda functions, we dont need to set the process just yet.


import lambda
codomain = ''
anon_steps = 'unknown'

def myFunction(domain=x):
    if  anon_steps is domain:
         codomain = 1
    else:
        pass
    return codomain

function_object = myFunction(domain)
# this is functional relationship

variable = lambda parameters_list : expression
# this is lambda expressed functions

in the above example lambda is the definition of the function and it expresses the code in the function.