How to check if pandas DateTimeIndex dates belong to a list?

  datetimeindex, pandas, python

I have a pandas datetime index idx with with minute frequency, I also have a list(or set) of dates list_of_dates. I would like to return a boolean array of the same size of idx with the condition that the dates of datetime index belong is in the list_of_dates. Is it possible to do it in a vectorized way (i.e. not using a for loop)?

Source: Python Questions

LEAVE A COMMENT