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)
Hey,
You can do like this:
dic = {'Name': ["Donna"], 'Age': [23]} pd.DataFrame(data=dic)
Hi, @Could you please clarify your query about what exactly you want to do?
Yes it worked for me!!!
Hello @Khanhh , Use panda to find the value of ...READ MORE
One thing that is really helpful in ...READ MORE
following way to find length of string x ...READ MORE
You can use a combination groupby function with the sum() method. ...READ MORE
You can use the rename function in ...READ MORE
The major difference is "size" includes NaN values, ...READ MORE
key error. I love python READ MORE
Emp_dict=Employee.to_dict('records') You can directly use the 'to_dict()' function ...READ MORE
If you want to find the value ...READ MORE
Try this: for name in df['Name']: ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.