Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
What DataFrames are
DataFrame columns
DataFrame rows
Filtering rows and columns
24. Filtering rows and columns with iloc
Filtering data frames
Sorting rows


Great! As with the loc function, you can filter rows and columns with the iloc function. With iloc you provide the indexes of the rows you want to filter. Before a comma, you provide row indexes, after the comma, you provide column indexes. Take a look:

hospitals.iloc[0:5, 0:2]

The line above would return the first five rows for the first two columns, according to the column order in the DataFrame.


Your turn now. Use the iloc function to return rows from the 10th row to the end of the DataFrame for the first three columns.