Skip to content

Instantly share code, notes, and snippets.

@timmapuramreddy
Forked from admond1994/remove_col_str.py
Created January 23, 2019 17:06
Show Gist options
  • Select an option

  • Save timmapuramreddy/265dd0eccbf61b0e4f0aee464260334a to your computer and use it in GitHub Desktop.

Select an option

Save timmapuramreddy/265dd0eccbf61b0e4f0aee464260334a to your computer and use it in GitHub Desktop.
def remove_col_str(df):
# remove a portion of string in a dataframe column - col_1
df['col_1'].replace('\n', '', regex=True, inplace=True)
# remove all the characters after &# (including &#) for column - col_1
df['col_1'].replace(' &#.*', '', regex=True, inplace=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment