I have a dataframe that looks like
df
viz a1_count a1_mean a1_std
n 3 2 0.816497
y 0 NaN NaN
n 2 51 50.000000
I want to convert the "viz" column to 0 and 1, based on a conditional. I've tried:
df['viz'] = 0 if df['viz'] == "n" else 1
but I get:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().