DataFrame rows are based on the index values. We can manipulate both rows and columns in pandas. On the other hand, index are the integer values representing the number of rows and columns separately. We can perform many operations on rows of a DataFrame on the basis of a specific condition. Here, we are going to find the index of rows whose column matches a certain value.
Following is the syntax for achieving this task:
Syntax:
DataFrame.index[df['column_name']=='particular_value'].tolist()
Here, the above syntax will return a list of indices of rows whose column matches the specific condition passed inside the DataFrame.index() method.
To work with Python Pandas, we need to import the pandas library. Below is the syntax,
import pandas as pd
Let us understand with the help of an example.
Output:

need an explanation for this answer? contact us directly to get an explanation for this answer