I have a column with numbers. I want to count the maximum number of consecutive negative numbers (ie: negative numbers in a row) in the column like below.
I think I should mask negative numbers first, but I could not figure it out.
numbers max_cons
0 -1 1
1 3 1
2 2 1
3 -3 1
4 -4 2
5 9 2
6 3 2
Any help would be appreciated.
Thanks