I'm trying to use np.where
to filter the column speed and where a condition is met assign a value in column 'C'
. For some reason I'm assigning everything as true. It seems to work fine for this person SO question so i'm a little stumped. Any help would be appreciated.
df["C"] = np.where(df.speed > 3, 'true','false')
speed C
0 3.34 true
1 0.02 true
2 0.01 true
3 8.41 true
4 0.03 true