I stumble again over the behavior of the replace method and I didn’t find a solution yet, even after searching other similar questions on stack overflow.
I want to replace some values in a column of a pandas df with another value, but I don’t get far with this.
This is what I tried and both didn’t work:
LStr['colname'].replace("valueToBeReplaced", "valueReplacement", inplace=True)
LStr['colname'].replace("valueToBeReplaced", "valueReplacement", inplace=True, regex=True)
LStr['colname']= LStr['colname'].replace("valueToBeReplaced", "valueReplacement", inplace=True)
LStr['colname']= LStr['colname'].replace("valueToBeReplaced", "valueReplacement", inplace=True, regex=True)
What do I actually need to change here, and why does it not work?
1