I have a pandas.DataFrame
with the following data:
x y z
0 1 -1 1
1 2 3 1
2 3 2 5
3 -1 -4 2
4 -2 3 1
5 -3 -2 -1
I am trying to find the rows that have all elements with the same sign (either negative or positive). In the example above, that would be rows 1, 2, and 5.
I have read Pandas - Compare positive/negative values, but it doesn’t address the case where the values are negative.
I would appreciate any help.