Created
January 28, 2019 22:21
-
-
Save adiamaan92/d55d478bb85bfb424d4ea80f2af06d2a to your computer and use it in GitHub Desktop.
This file contains 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 setcols(df, fn=lambda x: x.columns.map('_'.join), cols=None): | |
"""Sets the column of the data frame to the passed column list. | |
""" | |
if cols: | |
df.columns = cols | |
else: | |
df.columns = fn(df) | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment