Apr-11-2018, 02:40 AM
import pandas as pd z = pd.DataFrame({'Col1': [1,0,1,1,0,0,1], 'Col2': [0,1,1,1,0,1,0]}) # The number of rows, where both Col1 and Col2 == 0 ((z.Col1==0)&(z.Col2==0)).sum() # The number of rows, where Col1==0 and Col2 == 1 ((z.Col1==0)&(z.Col2==1)).sum() # The number of rows, where both Col1 and Col2 == 1 ((z.Col1==1)&(z.Col2==1)).sum()