My question is how I can use the re to replace strings that included in a dataframe:
when I use the re.sub(), it gives me an error:
p = re.compile('New')
p.sub('old', df['Col1'])
Also, I tried using the for loop but the out put was unexpected and displaying the value of the first row in all the other rows:
for i in df['Col1']:
p.sub('old', i)
print(i)
I'm sure that I'm missing something.