Created
December 11, 2020 20:25
-
-
Save redpoint13/327702207a0c3076b702daebee9b360e to your computer and use it in GitHub Desktop.
"""Clean non-printable characters from headers and data."""
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clean_df_chars(df): | |
"""Clean non-printable characters from headers and data.""" | |
df.columns.str.replace("/[^ -~]+/g", "").str.strip() | |
df = df.replace(to_replace="/[^ -~]+/g", value="", regex=True) | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment