Skip to main contentSkip to solution

Which of the following functions are used to split the data into groups based on some criteria?

Solution

✅ Correct Option: 2

GROUP BY splits the data into groups based on the values of one or more columns (in pandas it is written groupby()). An aggregate such as sum, mean or count is then applied to each group, following the split-apply-combine idea.


Option 1: split() breaks a string into parts at a separator. It does not group rows of data.

Option 3: first() returns the first value in each group, so it works only after the data has already been grouped.

Option 4: reset_index() only restores or renumbers the index of a DataFrame.

Keyboard Shortcuts

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