Question:

The way a dataset is arranged into rows and columns is referred to as the shape of data. Following function is used to reshape and create a new DataFrame from the original one:

Show Hint

The `pivot()` function is particularly useful when you need to rearrange the dataset based on the values in a column and turn those values into separate columns.
Updated On: Apr 24, 2025
  • dropna()
  • pivot()
  • sort()
  • merge()
    \textbf{Correct Answer:} (2) pivot()
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

In pandas, the `pivot()` function is used to reshape the DataFrame. It allows you to turn unique values from one column into multiple columns in the new DataFrame. Other options such as `dropna()`, `sort()`, and `merge()` serve different purposes (dropping missing values, sorting, and merging datasets, respectively), but they do not reshape the data as `pivot()` does.
Therefore, the correct answer is "pivot()".
Was this answer helpful?
0
0

Questions Asked in CUET exam

View More Questions