I have a dataframe like this:
Id  Seq Event
1     2    A 
1     3    B 
1     5    c 
1     6    A 
2     1    A 
2     2    B 
2     4    A 
2     6    B
I want to find how many times a specific pattern appears. Let's say "AB" . The output should be.
Id  Pattern_Count
1    1
2    2 
I tried using Event + Event.shift() and searching for the specific pattern. It's a tedious task when I have to search for a longer pattern like "ABCDE" and I don't want to shift it 4 times. Is there any alternative way to do this?
 
     
    