Question:easy

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

Show Hint

Splitting data into groups by a key is done with groupby(), the pandas version of SQL GROUP BY.
Updated On: Oct 1, 2026
  • split()
  • GROUP BY()
  • first()
  • reset_index()
Show Solution

The Correct Option is B

Solution and Explanation

Step 1: Idea:
We think about what each name does in practice, and pick the one whose job is to make groups. The question says split into groups based on some criteria, which is exactly the meaning of grouping by a key column.

Step 2: Think of an example.
Say a table has students and their class. To get the average marks of each class, we first gather the rows of the same class together. This gathering is done by df.groupby('class'). After it, .mean() is applied.

Step 3: Test each name against this job.
split() cuts text, so it has no link with gathering rows. first() picks one entry from each group, so it needs groups to exist already. reset_index() only renumbers the labels. The grouping name is the only one that fits.

Step 4: Note on spelling.
The option is written GROUP BY() in capital letters with a space, which looks like the SQL clause. In pandas the real method is groupby(). Since no other option can group data, this is the intended answer.

Step 5: Extra check.
As a last check, think of the result type. A grouping call returns a GroupBy object, and you then call a function like sum() or mean() on it. None of split(), first() or reset_index() returns such an object from a whole DataFrame, so none of them can start a grouping. This leaves only the grouping function.

Step 6: Conclusion.
Option 2 is correct. \[ \boxed{\text{GROUP BY()}} \]
Was this answer helpful?
0


Questions Asked in CUET (UG) exam