43215/how-to-find-the-index-of-a-particular-value-in-a-dataframe
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?
First, use the dataframe to match the value, and then find the index. Try this:
print(df[df[‘Name’]==’Donna’].index.values)