human
Replace all occurrences of a string in a pandas dataframe (Python)
assistant
Here is some code to replace all occurrences of a string `\n` by string `<br>` in a pandas data frame `df`

df.replace({'\n': '<br>'}, regex=True)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.