- DataFrame.loc()
DataFrame.loc(): Select rows by index value - DataFrame.iloc()
DataFrame.iloc(): Select rows by rows number
example Example:
- Select first 5 rows of a table, df1 is your dataframe
Select first 5 rows of a table, df1 is your dataframe
df1.iloc[:5]
df1.iloc[:5]
- Select first A, B rows of a table, df1 is your dataframe
Select first A, B rows of a table, df1 is your dataframe
df1.loc['A','B']
df1.loc['A','B']