Package: cythonintersectgroupercython
finds direct and nested intersections of listspip install cythonintersectgroupercythonTested against Windows 10 / Python 3.11 / AnacondaImportant!The module will be compiled when you import it for the first time. Cython and a C/C++ compiler must be installed!Findtheintersectionoftheinputlistsandnumpyarraysandreturnadictionarycontainingthedirectintersections,nestedintersections,quantityofintersections,arrayswithID,differentvalues,mappedIDs,hashes,andchecknumpyarray.Parameters:-list_:Theinputlistoflistsornumpyarrays-debug:Aflagtoenabledebugging(default:False)Returns:Adictionarycontainingthefollowingkeys:-direct_intersections:Adictionarycontainingthedirectintersectionsoftheinputlistsandnumpyarrays-nested_intersections:Anarraycontainingthenestedintersectionsoftheinputlistsandnumpyarrays-qty_of_intersections:Adictionarycontainingthequantityofintersectionsforeachinputlistornumpyarray-arrays_with_id:AnarraycontainingthearrayswithID-different_values:Thecountofdifferentvalues-mapped_ids:AdictionarycontainingthemappedIDsfromcythonintersectgroupercythonimportfind_intersection_of_listslist_=[[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,#     },# }