databenderr
databenderr

Reputation: 41

How can I solve the conditional probability question in a dataset in python?

df

Size gender  drink_water
    12    0        10
    15    1        15
    18    1        12
    8     0        8
    6     1        11
    .     .         .

Hello. I have a hypothetical data set,I have no other information. I want to know the probability of a dog of size 11 and gender 1 drinking less than 10 liters of water per month(I don't have these values in dataset). What can I do?

Average drink water per dog is 0.08.

Upvotes: 0

Views: 130

Answers (1)

Gruntrexpewrus
Gruntrexpewrus

Reputation: 15

I am assuming you want P('size' =11, 'gender' = 1, 'drink_waters' <10).

You sum the number of rows with columns 'gender' == 1 & 'size' == 11 & 'drink_waters' <10. Then you divide that sum by the length of your dataset(#rows) and you're done.

Upvotes: 1

Related Questions