Skip to main content

finds direct and nested intersections of lists

pip install cythonintersectgroupercython

Tested against Windows 10 / Python 3.11 / Anaconda

Important!

The module will be compiled when you import it for the first time. Cython and a C/C++ compiler must be installed!

Find the intersection of the input lists and numpy arrays and return a dictionary containing
the direct intersections, nested intersections, quantity of intersections, arrays with ID,
different values, mapped IDs, hashes, and check numpy array.

Parameters:
- list_: The input list of lists or numpy arrays
- debug: A flag to enable debugging (default: False)

Returns:
A dictionary containing the following keys:
- direct_intersections: A dictionary containing the direct intersections of the input lists and numpy arrays
- nested_intersections: An array containing the nested intersections of the input lists and numpy arrays
- qty_of_intersections: A dictionary containing the quantity of intersections for each input list or numpy array
- arrays_with_id: An array containing the arrays with ID
- different_values: The count of different values
- mapped_ids: A dictionary containing the mapped IDs
from cythonintersectgroupercython import find_intersection_of_lists
list_ = [
[5, 3, 4, 5],
[5, 11, 12, 3],
[52, 34],
[34, 111, 112],
[1000, 300],
[300, 5000],
]
inters=find_intersection_of_lists(list_)
print(inters)

# {
#     "direct_intersections": {
#         0: array([1], dtype=int64),
#         1: array([0], dtype=int64),
#         2: array([3], dtype=int64),
#         3: array([2], dtype=int64),
#         4: array([5], dtype=int64),
#         5: array([4], dtype=int64),
#     },
#     "nested_intersections": array(
#         [
#             [0, 1, -1, -1, -1, -1],
#             [0, 1, -1, -1, -1, -1],
#             [-1, -1, 2, 3, -1, -1],
#             [-1, -1, 2, 3, -1, -1],
#             [-1, -1, -1, -1, 4, 5],
#             [-1, -1, -1, -1, 4, 5],
#         ],
#         dtype=int64,
#     ),
#     "qty_of_intersections": {0: 2, 1: 2, 2: 1, 3: 1, 4: 1, 5: 1},
#     "arrays_with_id": array(
#         [
#             [0, 1, 2, 0],
#             [0, 3, 4, 1],
#             [5, 6, -1, -1],
#             [6, 8, 9, -1],
#             [10, 11, -1, -1],
#             [11, 12, -1, -1],
#         ],
#         dtype=int8,
#     ),
#     "different_values": 13,
#     "mapped_ids": {
#         0: 5,
#         1: 3,
#         2: 4,
#         3: 11,
#         4: 12,
#         5: 52,
#         6: 34,
#         7: "DUMMYVAL",
#         8: 111,
#         9: 112,
#         10: 1000,
#         11: 300,
#         12: 5000,
#     },
# }


list_ = [
[5, 3, 4, 5],
[5, 11, 12, 3],
[52, 34],
[34, 111, 112],
[1000, 300, 34],
[300, 5000],
]
inters = find_intersection_of_lists(list_)
print(inters)


# {
#     "direct_intersections": {
#         0: array([1], dtype=int64),
#         1: array([0], dtype=int64),
#         2: array([3, 4], dtype=int64),
#         3: array([2, 4], dtype=int64),
#         4: array([2, 3, 5], dtype=int64),
#         5: array([4], dtype=int64),
#     },
#     "nested_intersections": array(
#         [
#             [0, 1, -1, -1, -1, -1],
#             [0, 1, -1, -1, -1, -1],
#             [-1, -1, 2, 3, 4, 5],
#             [-1, -1, 2, 3, 4, 5],
#             [-1, -1, 2, 3, 4, 5],
#             [-1, -1, 2, 3, 4, 5],
#         ],
#         dtype=int64,
#     ),
#     "qty_of_intersections": {0: 2, 1: 2, 2: 2, 3: 2, 4: 3, 5: 1},
#     "arrays_with_id": array(
#         [
#             [0, 1, 2, 0],
#             [0, 3, 4, 1],
#             [5, 6, -1, -1],
#             [6, 8, 9, -1],
#             [10, 11, 6, -1],
#             [11, 12, -1, -1],
#         ],
#         dtype=int8,
#     ),
#     "different_values": 13,
#     "mapped_ids": {
#         0: 5,
#         1: 3,
#         2: 4,
#         3: 11,
#         4: 12,
#         5: 52,
#         6: 34,
#         7: "DUMMYVAL",
#         8: 111,
#         9: 112,
#         10: 1000,
#         11: 300,
#         12: 5000,
#     },
# }

Metadata

Release files for cythonintersectgroupercython 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cythonintersectgroupercython 0.10
File Size Uploaded Provenance Actions
cythonintersectgroupercython-0.10.tar.gz 26.9 kB Without provenance Details for cythonintersectgroupercython-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cythonintersectgroupercython 0.10
File Interpreter ABI Platform Actions
cythonintersectgroupercython-0.10-py3-none-any.whl Python 3 none any Details for cythonintersectgroupercython-0.10-py3-none-any.whl

Total release size: 54.6 kB

Release files / cythonintersectgroupercython-0.10.tar.gz

Download URL cythonintersectgroupercython-0.10.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
93ff892584f146244a1ecb6456aea951f6eeef1884e2d8c159b40c8787a2f6d5
BLAKE2b-256 checksum
How to use checksums
b2e02c79a6c7fa6a0fc5279a498bd574ce76874a30ce6a151f70c249103a4418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / cythonintersectgroupercython-0.10-py3-none-any.whl

Download URL cythonintersectgroupercython-0.10-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
834587e0b03ded0857e61a6e70cc7a4c1ea019a1fdd54513c8ab15b8943c364b
BLAKE2b-256 checksum
How to use checksums
911012bb5c2249564817d8b1a4335db18592514ce9e417dfff1eb82836f517cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for cythonintersectgroupercython 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page