Skip to main contentSkip to solution

Arrange the steps to split the data in to groups using the GROUP BY() based on some criteria:

A. Apply the required function.

B. Print the new DataFrame.

C. Combine the results to form a new DataFrame.

D. Split the data into groups by creating a GROUP BY object from the original DataFrame.

Solution

✅ Correct Option: 1

GROUP BY follows the split-apply-combine pattern, and printing comes last.

D. Split the data into groups by creating a GROUP BY object from the original DataFrame.

A. Apply the required function (such as sum, mean or count) to each group.

C. Combine the results to form a new DataFrame.

B. Print the new DataFrame.


Option 2: combining before applying the function is wrong, because the combined DataFrame is made from the results of the function.

Keyboard Shortcuts

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