Answers for "how to select a specific row in pandas and get index"

2

pandas select row by index

#for single row
df.loc[ index , : ]

# for multiple rows
indices = [1, 20, 33, 47, 52 ]
new_df= df.iloc[indices, :]
Posted by: Guest on April-10-2021
1

pandas return specific row

df.iloc[1] # replace index integer with specific row number
Posted by: Guest on December-10-2020

Code answers related to "how to select a specific row in pandas and get index"

Python Answers by Framework

Browse Popular Code Answers by Language