I cannot get this to replicate outside of this file, since if I try it on a string myself it works, but for some reason not in my dataframe.
I just want to get rid of the ‘n’ characters in my strings, but its not working, as seen below.
I’ve tried the following, with no success
UseCaseMethodsCols.apply(lambda x: ' ' if 'n' in x else x) UseCaseMethodsCols = UseCaseMethodsCols.replace(r'n', ' ').replace(r'r', '')
Advertisement
Answer
Try adding regex=True
to the replace
calls:
UseCaseMethodsCols = UseCaseMethodsCols.replace(r'n', ' ', regex=True)