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
import pandas as pd
bikes=["bajaj","tvs","herohonda","kawasaki","bmw"]
cars=["lamborghini","masserati","ferrari","hyundai","ford"]
d={"cars":cars,"bikes":bikes}
df=pd.DataFrame(d)
a=[10,20,30,40,50]
df.index=a
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.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment