Introduction
Series
What DataFrames are
DataFrame columns
DataFrame rows
Filtering rows and columns
24. Filtering rows and columns with iloc
Filtering data frames
Sorting rows
Summary

Instruction

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.

Exercise

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.