How to find index of element in dataframe Python

+1 vote

Hi. I have a pandas dataframe and I want to find the index of a particular entry in it.

  Name Age
0 Mike 23
1 Eric 25
2 Donna 23
3 Will 23

This is the dataframe. I want to find the index of ‘Donna’. How can I do it?

Apr 8, 2019 in Python by Raj
285,626 views

1 answer to this question.

+2 votes

First, use the dataframe to match the value, and then find the index. Try this:

print(df[df[‘Name’]==’Donna’].index.values)
answered