I\'d like to find a particular pattern in a pandas dataframe column, and return the corresponding index values in order to subset the dataframe.
Here\'s a sample dat
Using the magic of list comprehensions:
[df.index[i - len(pattern)] # Get the datetime index for i in range(len(pattern), len(df)) # For each 3 consequent elements if all(df['ColA'][i-len(pattern):i] == pattern)] # If the pattern matched # [Timestamp('2017-07-10 00:00:00')]