Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Outputting Rows by Index | Getting Familiar With Indexing and Selecting Data
Advanced Techniques in pandas

bookOutputting Rows by Index

Pandas has plenty of valuable tools; for instance, it allows you to output only specific rows. We will work with the same dataset.

  • data[0:3] - outputs the rows from zero to three 0, 1, 2, for all columns (pay attention, this method doesn't include the last index);
  • data[:3] - outputs the rows from zero to three 0, 1, 2, for all columns;
  • data[997:999] - outputs rows from 997 to 999: 997 and 998, for all columns (this is the last row);
  • data[997:] - outputs rows from 997 to the last one: 997, 998, 999, for all columns;
  • data[:] - outputs all rows of the dataset data for all columns.
question mark

Select all options with the correct syntax for outputting rows by indices:

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 2

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Awesome!

Completion rate improved to 3.03

bookOutputting Rows by Index

Veeg om het menu te tonen

Pandas has plenty of valuable tools; for instance, it allows you to output only specific rows. We will work with the same dataset.

  • data[0:3] - outputs the rows from zero to three 0, 1, 2, for all columns (pay attention, this method doesn't include the last index);
  • data[:3] - outputs the rows from zero to three 0, 1, 2, for all columns;
  • data[997:999] - outputs rows from 997 to 999: 997 and 998, for all columns (this is the last row);
  • data[997:] - outputs rows from 997 to the last one: 997, 998, 999, for all columns;
  • data[:] - outputs all rows of the dataset data for all columns.
question mark

Select all options with the correct syntax for outputting rows by indices:

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 2
some-alt