Skip to main content

Package for grouping array objects in list by some key

Project description

A function that implements grouping of objects by some key. For example, the string 'AAAABBBCAAB' is given. The result of the program should be:[('A', ['A', 'A', 'A', 'A']), ('B', ['B', 'B'¸'B']), ('C', ['C']), ('A', ['A', 'A']), ('B', ['B'])]. It is also possible to use the function to determine the key for grouping. For example, for a list of tuples: [('foo', 1), ('bar', 1), ('foobar', 2), ('baz', 3)], when using the second element of the tuple as the key, the result should be [(1, [('foo', 1), ('bar', 1)]), (2, [('foobar', 2)]), (3, [('baz', 3)])].

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grouping_list_tuple-1.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page