I have a pandas data frame with date column, and I am trying to add a new column of boolean values indicating whether a given date is a holiday or not.
Following is the code, but it does not work (all the values are False) because the types seem to be different, and I can't figure out how to get the 'date' in the pandas data frame to be of the same type as the holidays:
cal = USFederalHolidayCalendar()
holidays = cal.holidays(start=train_df['date'].min(),
end=train_df['date'].max()).to_pydatetime()
train_df['holiday'] = train_df['date'].isin(holidays)
print type(train_df['date'][1])
print type(holidays[0])