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
JavaScript
x
4
1
UseCaseMethodsCols.apply(lambda x: ' ' if 'n' in x else x)
2
UseCaseMethodsCols = UseCaseMethodsCols.replace(r'n', ' ').replace(r'r', '')
3
4
Advertisement
Answer
Try adding regex=True
to the replace
calls:
JavaScript
1
2
1
UseCaseMethodsCols = UseCaseMethodsCols.replace(r'n', ' ', regex=True)
2