How to find index of element in dataframe Python ?
Hi. I possess a pandas dataframe and I am seeking to identify the index of a specific entry within 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?
2021-06-14 in Python by Nicholas
| 283,015 Views
Write a Comment
Your email address will not be published. Required fields are marked (*)
All answers to this question.
First, use the dataframe to match the value, and then find the index. Try this:
print(df[df[Name]==Donna].index.values)
Answered 2021-08-20 by Hemant