I have a data file full of dates, and I would like to select all dates where month == 12 and day == 25, and add replace zero in the xmas column with 1.
Anyway to do this? second line of errors of my code.
df = DataFrame({'date':[datetime(2013,1,1).date() + timedelta(days=i) for i in range(0,365*2)], 'xmas':np.zeros(365*2)}) df[df['date'].month==12 and df['date'].day==25] = 1
python pandas datetime
user3439329
source share