select specific rows from dataframe in python

df.iloc[[index]]

Here is what the above code is Doing:
1. We’re creating a new DataFrame called df_subset.
2. We’re using the .iloc[] method to select the row at index 0 of df and assign it to df_subset.
3. We’re using the .iloc[] method to select the row at index 1 of df and assign it to df_subset.
4. We’re using the .iloc[] method to select the row at index 2 of df and assign it to df_subset.
5. We’re using the .iloc[] method to select the row at index 3 of df and assign it to df_subset.
6. We’re using the .iloc[] method to select the row at index 4 of df and assign it to df_subset.
7. We’re using the .iloc[] method to select the row at index 5 of df and assign it to df_subset.
8. We’re using the .iloc[] method to select the row at index 6 of df and assign it to df_subset.
9. We’re using the .iloc[] method to select the row at index 7 of df and assign it to df_subset.
10. We’re using the .iloc[] method to select the row at index 8 of df and assign it to df_subset.
11. We’re using the .iloc[] method to select the row at index 9 of df and assign it to df_subset.