I am trying to convert particular values in given rows of a column into specific strings.
I want the value 1 to be converted to 'never', the value 2 to be converted to 'former' and the value 3 to be converted to 'current'.
However, when I run the following code, I get the error: 'list' object has no attribute 'loc'.
newdata = newdf.groupby('smoking-number').mean().reset_index()
sem = newdf.groupby('smoking-number').sem().reset_index()
newdata = newdata.loc[(newdata[['smoking_number']]==1) & (newdata[['smoking_number']]==2) & (newdata[['smoking_number']]==3)] = [['never','former','current']]
Would anybody be able to give me a helping hand?