I have a column in data frame like this (an simplify example):
col
a
b
c
d
e
f
g
and I want to change the values like this:
col
a
b
other
other
other
other
other
I tried like this:
df = df.loc[df.col == ("a" or "b"), "col"] = "other"
but it does not work, I have an error:
AttributeError: 'str' object has no attribute 'loc'
Any advices?