Skip to content

Instantly share code, notes, and snippets.

@dejmail
Forked from smram/pandas_newline_strip.txt
Created April 24, 2019 07:10
Show Gist options
  • Select an option

  • Save dejmail/bd5215f4213507daa29c905b3b018286 to your computer and use it in GitHub Desktop.

Select an option

Save dejmail/bd5215f4213507daa29c905b3b018286 to your computer and use it in GitHub Desktop.
[pandas] replace newlines,tabs,carriage returns in fields
# got to handle both escaped and literal
df.replace(to_replace=[r"\\t|\\n|\\r", "\t|\n|\r"], value=["",""], regex=True, inplace=<INPLACE>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment