here is one good explained topic on stackoverflow: Replacing few values in a pandas dataframe column with another value
The example is:
BrandName Specialty
A H
B I
ABC J
D K
AB L
and the solution is:
df['BrandName'] = df['BrandName'].replace(['ABC', 'AB'], 'A')
The problem is my dataframe is a little bit different, I have two strings in a row:
BrandName Specialty
A H
B I
ABC B J
D K
AB L
The desired output still is:
BrandName Specialty
A H
B I
A B J
D K
A L
How can I achieve this?