_____________ function is used to reshape and create a new DataFrame from the original one.
_____________ 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.
Related questions:
2025: 14 May Shift 1
2025: 16 May Shift 1
2025: 20 May Shift 1