Skip to content

Instantly share code, notes, and snippets.

@fnneves
Created January 6, 2020 22:52
Show Gist options
  • Save fnneves/29ce01fa9241a9800dbdf4d7248ac9a9 to your computer and use it in GitHub Desktop.
Save fnneves/29ce01fa9241a9800dbdf4d7248ac9a9 to your computer and use it in GitHub Desktop.
def clean_header(df):
"""
This functions removes weird characters and spaces from column names, while keeping everything lower case
"""
df.columns = df.columns.str.strip().str.lower().str.replace(' ', '_').str.replace('(', '').str.replace(')', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment