I would like to replace words as described here but for a column in a dataframe. I also want to keep the original column and other columns in the dataframe.
a = ["isn't", "can't"]
b = ["is not", "cannot"]
for line in df['text']:
for a1, b1 in zip(a, b):
line = line.replace(a1, b1)
df['text1'].write(line)
TypeError: expected str, bytes or os.PathLike object, not Series
Input dataframe
ID text
1 isn't bad
2 can't play
Output
ID text text1
1 isn't bad is not bad
2 can't play cannot play
Please help. Thank you.