I have a Pandas data frame as mentioned below:
sr_no amount_credit_debit
1 1000
2 1234
3 -2378
4 -1290
5 3000
6 -4567
8 5678
9 1390
10 -2346
11 -2876
12 -9065
13 -6743
I have to count groups of consecutive negative numbers in above df.
(-2378 and -1290) = First negative instance
(-4567) = Second negative instance
(-2346,-2876,-9065,-6743) = Third negative instance
output is 3
which is my answer.
I have tried a lot but cannot get right answer