MulaiMulai sekarang secara gratis

The many flavors of .iloc

There are multiple ways to index a pandas DataFrame – maybe too many. In this exercise, you're going to explore the many usages – or pitfalls of the .iloc indexer. This is something that will likely trip you up on your Python adventure, so it's good to know up front what you'll be up against.

Specifically, in this exercise, you'll learn to use .iloc in three slightly different ways that each return drastically different results.

Latihan ini adalah bagian dari kursus

Python for MATLAB Users

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Access first row and first column
iloc_1 = animals.____[____,____]
print(iloc_1)
print(type(iloc_1))
Edit dan Jalankan Kode