Selecting a row in Pandas

Hello, I couldn’t find it on the forums, hence I’m asking my doubt here.

To select a single row from a dataframe we used the .iloc method. We passed in the row index ( which start from 0 onwards) as an argument.

Now, if we have say thousands of rows, how do we select a row whose index is large and hard to remember ??? Is there a simpler method to select a row in thousands of rows?? For example, if we have customer_id column, how do I select a specific customer_id amongst the thousands of customer_id’s present in the table ???

df[df["customer_id"] == '123456']

2 Likes

Thanks @core9221442141 this is a lot better way to select specific rows !!!