Skip to main contentSkip to solution

Arrange the following functions of GROUP BY according to its working strategy:

(A) Combine the results

(B) Split the data

(C) Create the input DataFrame

(D) Apply the function

Solution

✅ Correct Option: 3

GROUP BY in pandas follows the split-apply-combine strategy. The input DataFrame must exist first, then it is split into groups, the function is applied to each group, and the results are combined.

(C) Create the input DataFrame

(B) Split the data into groups by the key

(D) Apply the function (sum, mean, count, etc.) to each group

(A) Combine the results into a new DataFrame or Series


Option 2: combining cannot come before applying, because there are no per-group results to combine until the function has run.

Keyboard Shortcuts

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