Efficiently replace part of value from one column with value from another column in pandas using regex?
问题 I have a pandas dataframe df with dates as strings: Date1 Date2 2017-08-31 1970-01-01 17:35:00 2017-10-31 1970-01-01 15:00:00 2017-11-30 1970-01-01 16:30:00 2017-10-31 1970-01-01 16:00:00 2017-10-31 1970-01-01 16:12:00 What I want to do is replace each date part in the Date2 column with the corresponding date in Date1 but leave the time untouched, so the output is: Date1 Date2 2017-08-31 2017-08-31 17:35:00 2017-10-31 2017-10-31 15:00:00 2017-11-30 2017-11-30 16:30:00 2017-10-31 2017-10-31 16