I have seen many ways to locate a data frame for one date range,
i.e.
mask = (df["TimeStamp"] > date_range[0]) & (df["TimeStamp"] < date_range[1])
df = df.loc[mask]
but I can't find out how to do this if I had multiple date ranges
i.e.
date_ranges = [date_range_1, date_range_2, date_range_3, ... , date_range_n]
I would need something like
mask = ()
for date_range in date_ranges:
sub_mask = (df["TimeStamp"] > date_range[0]) & (df["TimeStamp"] < date_range[1])
mask.append(sub_mask)
df = df.loc[mask]
but of course this doesn't work for a variety of reasons (you need an or statement between the ands, and you cant append these masks in this way)
could anybody give me a nudge in the right direction?