Created
May 12, 2023 12:30
-
-
Save mwestwood/ef403f1119cb01f93bec3b45f9d78f83 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
import pandas as pd | |
# Create a sample DataFrame | |
df = pd.DataFrame({ | |
'Column1': ['A', 'B', 'C'], | |
'Column2': ['X', 'Y', 'Z'], | |
'Column3': ['1', '2', '3'] | |
}) | |
# Combine the three columns delimited by | | |
df['Combined'] = df['Column1'].str.cat([df['Column2'], df['Column3']], sep='|') | |
print(df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment