Last active
January 9, 2020 21:12
-
-
Save fnneves/e7483dbffe0af272f85cec24cbaa7726 to your computer and use it in GitHub Desktop.
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 split_columns(df, orig, one, two, separator): | |
""" | |
orig: string name of the column we want to split | |
one: string name of the first new column | |
two: string name of the second new column | |
separator: string - this is the character(s) that will define where to split | |
""" | |
df[[one,two]] = df[orig].str.split(separator,expand=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment