I would like to count the number of a claim where claimnb=0
and bm=1
. This is my code for first argument but how to add the second condition?
(data['ClaimNb'] == 0).sum()
Assuming you are using Numpy, try using &
to combine the 2 conditions:
((data['ClaimNb'] == 0) & (data['bm'] == 1)).sum()
Make sure you add the parentheses around each condition.
See How to use NumPy where with multiple conditions in Python for more information about combining conditions in Numpy expressions.