I have the following data file.
1 3
2 6
3 7
4 6
5 8
6 4
7 5
8 9
9 7
10 2
11 3
12 5
13 3
My goal is to have a count of items that are equal to or greater than 5 in column 2 which appear at least 3 times in succession. I have been able to figure out the counting part but not the succession part.
So, I want the output of this data file to be 2 as in column 2 there are 2 strings (6,7,6,8) and (5,9,7) where I have numbers that are equal to and greater than 5 appearing at least 3 times in succession.
import numpy as np
data=np.loadtxt('/Users/Hrihaan/Desktop/DataF.txt')
z=data[:,1]
count = len([i for i in z if i >= 5])
print(count)
Any help would be greatly appreciated.