combine two date columns together to form one in python

df['Date']= df.apply(lambda x: x['start'] + ' '+'to'+ ' '+x['end'],1)

Or

df['Date']=df.groupby(df.index).apply(lambda x:x['start'].str.cat(x['end'], sep=' to '))



 start         end id                      Date
0  10/01/2020  11/01/2020  a  10/01/2020 to 11/01/2020

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top