The process of changing the structure of a DataFrame using function pivot() is known as ___________.
The process of changing the structure of a DataFrame using function pivot() is known as ___________.
Solution
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.
Related questions:
2025: 27 May Shift 2
2026: 13 May Shift 2