iloc and loc are both used to select rows and columns from a Pandas DataFrame, but they work differently.