Skip to main contentSkip to solution

Solution

✅ Correct Option: 3

The attribute TT (written df.T) swaps the rows and columns of a DataFrame, so row labels become column labels and the other way round. It is an attribute, so it is written without parentheses.


Option 4: reindex() changes the row or column labels to a new set of labels. It does not swap rows and columns.

Options 1 and 2: reverse() and invert() are not DataFrame methods for transposing. reverse() belongs to Python lists.

Keyboard Shortcuts

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