Last active
July 13, 2020 15:26
-
-
Save lisanka93/fc3b2adfcbfe01745df5f35ce4dbd4d8 to your computer and use it in GitHub Desktop.
Merging several columns in python pandas
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
df['ColumnA'] = df[df.columns[1:]].apply( | |
lambda x: ' '.join(x.dropna().astype(str)), | |
axis=1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment