Skip to main content

Groups lists by common intersections

Project description

Groups lists by common intersections

pip install intersection-grouper
from intersection_grouper import group_lists_with_intersections



listgroup = [

    [5, 3, 4, 5],

    [5, 11, 12, 3],

    [52, 34],

    [34, 111, 112],

    [1000, 300],

    [300, 5000],

]



x = group_lists_with_intersections(listgroup, keep_duplicates=True)

print(x)

[(34, 34, 52, 111, 112), (300, 300, 1000, 5000), (3, 3, 4, 5, 5, 5, 11, 12)]



x2 = group_lists_with_intersections(listgroup, keep_duplicates=False)

print(x2)

[(34, 52, 111, 112), (300, 1000, 5000), (3, 4, 5, 11, 12)]

Project details


Download files

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

Source Distribution

intersection_grouper-0.11.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

intersection_grouper-0.11-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

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