def confusion(df, labels=['<STR_LIT>', '<STR_LIT>']):
c = pd.DataFrame(np.zeros((<NUM_LIT:2>, <NUM_LIT:2>)), dtype=int)<EOL>a, b = df.columns[:<NUM_LIT:2>]  <EOL>c.columns = sorted(set(df[a]))[:<NUM_LIT:2>]<EOL>c.columns.name = a<EOL>c.index = list(c.columns)<EOL>c.index.name = b<EOL>c1, c2 = c.columns<EOL>c[c1][c1] = ((df[a] == c1) & (df[b] == c1)).sum()<EOL>c[c1][c2] = ((df[a] == c1) & (df[b] == c2)).sum()<EOL>c[c2][c2] = ((df[a] == c2) & (df[b] == c2)).sum()<EOL>c[c2][c1] = ((df[a] == c2) & (df[b] == c1)).sum()<EOL>return c<EOL>
Binary classification confusion