Skip to main contentSkip to solution

The process of changing the structure of a DataFrame using function pivot() is known as ___________.

Solution

✅ Correct Option: 4

The pivot() function in pandas reorganises a DataFrame by turning the unique values of one column into new column headers, and the values of another column into row labels. This changes the shape and layout of the table, so the process is called reshaping.


Transpose: DataFrame.T simply swaps rows and columns, and does not use column values as new labels.

Reindexing: reindex() conforms the DataFrame to a new set of row or column labels, and does not restructure the data.

Resetting: reset_index() only moves the index back into a column and restores a default integer index.

Keyboard Shortcuts

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