[Solved] find number of 1 and 0 combinations in two columns


Assuming you have a pandas dataframe, one option is to use pandas.crosstab to return another dataframe:

import pandas as pd

df = pd.read_csv('file.csv')
res = pd.crosstab(df['X'], df['Y'])

print(res)

Y  0  1
X      
0  3  7
1  1  3

A collections.Counter solution is also possible if a dictionary result is required:

res = Counter(zip(df['X'].values, df['Y'].values))

4

solved find number of 1 and 0 combinations in two columns