I'm trying to replace values in my dataframe lower than 5.5 with 'insufficient' and higher than 5.5 with 'sufficient' using the following code:
import numpy as np
df['test'] = np.where(df['grade'] > 5.5, 'sufficient', 'insufficient')
This gives me the following error:
TypeError: '>' not supported between instances of 'str' and 'float'
How do I replace my float dataframe values with strings?