I have a dataframe that looks like this:
Person Length Sport
A 1.80 1
B 1.85 2
A 1.80 2
I tried the following code:
pd.get_dummies(data=df, columns=['Sport'])
Which gave me the following output:
Person Length 1 2
A 1.80 1 0
B 1.85 0 1
A 1.80 0 1
I'm trying to get the following output:
Person Length 1 2
A 1.80 1 1
B 1.85 0 1
Is there a solution for this?