To combine two columns from two dataframes with a separator in pandas, you can use the merge()
or join()
function in python.
Assuming you have two dataframes df1
and df2
, and you want to combine the columns 'col1' from df1
and 'col2' from df2
with a separator '-', you can do the following:
main.py551 chars19 lines
This will output the following merged dataframe with the combined column:
main.py76 chars5 lines
gistlibby LogSnag