python - Get index when looping through one column of pandas ...
stackoverflow.com › questions › 41070549Dec 09, 2016 · Show activity on this post. I have a simple dataframe: index, a, y 0 , 1, 2 1 , 4, 6 2 , 5, 8. I want to loop through the "a" column, and print out its index for a specific value. for x in df.a: if x == 4: print ("Index of that row") What syntax should I use to obtain the index value when the for loop hits the specific value in the "a" column ...