Index a b c d e f g h i j zeros
0 9 -8 -3 0 0 3 0 0 0 3 5
1 0 0 8 2 -5 0 0 -5 4 12 4
2 0 0 3 13 0 -9 11 -2 5 0 4
3 0 0 1 12 1 0 11 -6 1 0 4
4 0 0 1 11 0 -3 0 -2 -6 12 4
5 0 0 1 0 6 -5 0 -5 3 7 4
6 0 0 0 12 -6 0 2 7 -1 2 4
7 0 0 0 0 5 -5 5 0 8 7 5
8 0 0 0 0 0 0 0 0 0 0 10
9 0 0 -2 12 0 -1 0 3 6 3 4
10 0 0 -4 3 -4 0 0 4 -1 1 4
I want to sort my dataframe based on highest zeros which can be done easily by sorting using zeros column. but in case of 1st adn 7 row i have the same number of zeros. In this case i am suppose to look at the order of occurance of 0's from left of the dataframe to the right (from column a to column j) which should give me the output as shown below: basically, when you look at the order of zeros you will see that in the result i have 4 columns containing zeros being placed first out of two rows contianing zeros = 5.

