Raw dataframe:
A B
hello world a
say hello a
I try to do it a
We say a
like saying hello a
Expectation
For column A, 'world' is replaced by 'a','do' is replaced by 'finish','say' is replaced by 'guess'.
Trying
df['A'].str.replace('world','a').str.replace('do','finish').str.replace('say','guess')
It's done but it's a long code and very inefficient, especially dealing with many strings( >100 ).
Hope
A more pretty and concise way to replace multiple strings in pandas.