I just started studying pandas and I had a question: I need to use a regular expression to find strings of a certain pattern and replace the entire string with this pattern. I used :
df.replace(to_replace=r'^[Gg]eramny', value='Berlin', regex=True)
Source string: 'Platz der Republik 1, 10557 Berlin, germany'
My code outputs: 'Platz der Republik 1, 10557 Berlin, Berlin'
But I need the line: 'Berlin'
