- Grouping by equality
groupby function divides a sequence into contiguous subsequences where the elements in each subsequence share something in common.
Grouping by equality
When used with a single parameter,
itertools.groupby finds groups of repeated elements.The reason this function is named “groupby” instead of “group” won’t become clear until we discuss the optional