Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Function iloc() 2/2 | The Very First Steps
Pandas First Steps

Function iloc() 2/2Function iloc() 2/2

The DataFrame we are working with:

Example

In the DataFrame we're working with, you can also use negative indexing. Negative indexing starts from the end of the DataFrame: index -1 points to the last row, -2 to the second to last, and so on.

To access the seventh row (which refers to Latvia), you can use either index 6 or -1. Let's see how this works in practice.

Running the above code will return the row highlighted in the image below:

Example

It's time to practice!

Завдання

We have a DataFrame called audi_cars.

  1. Display all the details from the DataFrame for the Audi A1 model from the year 2017. To do this, you'll need to use positive indexing.
  2. Display all the details from the DataFrame for the Audi A1 model from the year 2016 using negative indexing.
  3. Display all the details from the DataFrame for the Audi A3 model using positive indexing.

Make sure to use the iloc() function. Give it a try!

Task Table

Все було зрозуміло?

Секція 1. Розділ 14
toggle bottom row
course content

Зміст курсу

Pandas First Steps

Function iloc() 2/2Function iloc() 2/2

The DataFrame we are working with:

Example

In the DataFrame we're working with, you can also use negative indexing. Negative indexing starts from the end of the DataFrame: index -1 points to the last row, -2 to the second to last, and so on.

To access the seventh row (which refers to Latvia), you can use either index 6 or -1. Let's see how this works in practice.

Running the above code will return the row highlighted in the image below:

Example

It's time to practice!

Завдання

We have a DataFrame called audi_cars.

  1. Display all the details from the DataFrame for the Audi A1 model from the year 2017. To do this, you'll need to use positive indexing.
  2. Display all the details from the DataFrame for the Audi A1 model from the year 2016 using negative indexing.
  3. Display all the details from the DataFrame for the Audi A3 model using positive indexing.

Make sure to use the iloc() function. Give it a try!

Task Table

Все було зрозуміло?

Секція 1. Розділ 14
toggle bottom row
some-alt