Question #235915

How to fetch a data entry from a pandas dataframe using a given value in index?

To fetch a row from dataframe given index x, we can use loc.

Df.loc[10] where 10 is the value of the index.

Code

get me the code


Expert's answer

data.set_index("x", inplace=True)
data.loc[10]

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS