I'm using a Pandas dataframe indexed by datetimes that looks something like this:
TimeSys_Index
2014-08-29 00:00:18 0
2014-08-29 00:00:19 0
2014-08-29 00:00:20 1
2014-08-29 00:00:21 1
2014-08-29 00:00:22 0
2014-08-29 00:00:23 0
2014-08-29 00:00:24 0
2014-08-29 00:00:25 0
2014-08-29 00:00:26 0
2014-08-29 00:00:27 1
2014-08-29 00:00:28 1
2014-08-29 00:00:29 1
2014-08-29 00:00:30 1
2014-08-29 00:00:31 0
2014-08-29 00:00:32 0
2014-08-29 00:00:33 0
...
I want to find the index (time) for every occurrence of the pattern [0, 0, 1, 1]. Using the above sequence I'd like it to return ['2014-08-29 00:00:18', '2014-08-29 00:00:25']. The kicker is this needs to be vectorized or at least very quick.
I was thinking of running a correlation of the full vector with the pattern vector and finding the indices where the resulting vector equals 4, but there's got to be a simpler way.