What I want to do is replace a column value with "0" if, for a given row, that column is not maximal. And conversely, replace the column value with "1" if, for a given row, that column IS maximal.
My data looks like this:
data = {
"A": [1, 2, 3],
"B": [3, 5, 1],
"Max": ["B", "B", "A"]
}
data_df = pd.DataFrame(data)
print(data_df)
A B Max
0 1 3 B
1 2 5 B
2 3 1 A
But I want it to look like
A B Max
0 0 1 B
1 0 1 B
2 1 0 A