Skip to main contentSkip to solution

_____________ function is used to reshape and create a new DataFrame from the original one.

Solution

✅ Correct Option: 2

The pivot() function reshapes a DataFrame. It uses the values of one column as the new index, another column's values as the new columns, and a third column to fill the cells, returning a new DataFrame. For example, df.pivot(index='Date', columns='City', values='Temp').


Option 1: DataFrame() is the constructor that creates a DataFrame from data, not a function that reshapes an existing one.

Options 3 and 4: Pandas and NumPy are libraries (modules), not functions.

Keyboard Shortcuts

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