Skip to main contentSkip to solution

________ is the command to display the last 2 rows of a DataFrame.

Solution

✅ Correct Option: 1

DataFrame.tail(n) returns the last nn rows of a DataFrame, so tail(2) gives the last 2 rows, and print() displays them.


Option 2: a negative value in tail(-2) returns all rows except the first 2, not the last 2.

Option 3: head(-2) returns all rows except the last 2.

Option 4: tail() with no argument returns the last 5 rows by default.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question