df['view'] = np.where(df['view']==0, 'No view', df['view'])
df['view'] = np.where(df['view']==1, 'Mediocore', df['view'])
df['view'] = np.where(df['view']==2, 'Average', df['view'])
df['view'] = np.where(df['view']==3, 'Good', df['view'])
df['view'] = np.where(df['view']==4, 'Very good', df['view'])
i have a dataset of housing prices where the 'view' column rates the view on a scale of 1-4. I wanted to change those into string using this operation however this bit of code ONLY works for the first line.
df['view'].value_counts()
-No view 4140
2 205
3 116
4 70
1 69
Name: view, dtype: int64
how do i make np.where() work for the rest of them as well?