CommencerCommencer gratuitement

Selecting rows

You can subset rows either using the row name (.loc accessor) or the row index (.iloc accessor).

To perform conditional subsetting, you pass .loc a boolean expression, and all the rows that match the boolean expression will be returned. When using multiple conditions, you can use the & or | operators for 'and' and 'or', respectively. Remember, you need to surround each conditional statement inside parentheses.

Cet exercice fait partie du cours

Python for R Users

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Print the first row of tips using iloc
print(tips____)
Modifier et exécuter le code