I have dataframe as bellow , I need to get the index of first changing value 0 in column y
x1 x2 y
12 7 1
0 3 0
5 11 1
7 2 1
4 8 1
1 0 0
5 0 0
0 9 0
2 2 1
So it would be some thing like this
x1 x2 y
0 3 0
1 0 0
I have tried this but it just print out the index where elements change
print(df.iloc[:,2].diff()[df.iloc[:,2].diff() != 0].index.values)
Thanks