Say I have a data frame of 10,000+ rows with columns Day and Month where Month is a datetime object. The value for "day" in the Month object is incorrect so I want to replace it with the corresponding value from the Day column. How would I go about doing that?
import datetime as dt
df = pd.DataFrame({
'Month': [dt.date(2017,9,1),dt.date(2017,11,1),dt.date(2017,9,1)],
'Day': [7, 21,14],
})
Day Month
7 2017-09-01
21 2017-11-01
14 2017-09-01
So I want the end result to look like this:
Day Month New_Col
7 2017-09-01 2017-09-07
21 2017-11-01 2017-11-21
14 2017-09-01 2017-09-14