# 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!
```python
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,
# },
# }
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/cythonintersectgroupercython",
"name": "cythonintersectgroupercython",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "intersection,group",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b2/e0/2c79a6c7fa6a0fc5279a498bd574ce76874a30ce6a151f70c249103a4418/cythonintersectgroupercython-0.10.tar.gz",
"platform": null,
"description": "\r\n# finds direct and nested intersections of lists \r\n\r\n## pip install cythonintersectgroupercython\r\n\r\n### Tested against Windows 10 / Python 3.11 / Anaconda \r\n\r\n### Important!\r\n\r\nThe module will be compiled when you import it for the first time. Cython and a C/C++ compiler must be installed!\r\n\r\n```python\r\nFind the intersection of the input lists and numpy arrays and return a dictionary containing\r\nthe direct intersections, nested intersections, quantity of intersections, arrays with ID,\r\ndifferent values, mapped IDs, hashes, and check numpy array.\r\n\r\nParameters:\r\n- list_: The input list of lists or numpy arrays\r\n- debug: A flag to enable debugging (default: False)\r\n\r\nReturns:\r\nA dictionary containing the following keys:\r\n- direct_intersections: A dictionary containing the direct intersections of the input lists and numpy arrays\r\n- nested_intersections: An array containing the nested intersections of the input lists and numpy arrays\r\n- qty_of_intersections: A dictionary containing the quantity of intersections for each input list or numpy array\r\n- arrays_with_id: An array containing the arrays with ID\r\n- different_values: The count of different values\r\n- mapped_ids: A dictionary containing the mapped IDs\r\nfrom cythonintersectgroupercython import find_intersection_of_lists\r\nlist_ = [\r\n[5, 3, 4, 5],\r\n[5, 11, 12, 3],\r\n[52, 34],\r\n[34, 111, 112],\r\n[1000, 300],\r\n[300, 5000],\r\n]\r\ninters=find_intersection_of_lists(list_)\r\nprint(inters)\r\n\r\n# {\r\n# \"direct_intersections\": {\r\n# 0: array([1], dtype=int64),\r\n# 1: array([0], dtype=int64),\r\n# 2: array([3], dtype=int64),\r\n# 3: array([2], dtype=int64),\r\n# 4: array([5], dtype=int64),\r\n# 5: array([4], dtype=int64),\r\n# },\r\n# \"nested_intersections\": array(\r\n# [\r\n# [0, 1, -1, -1, -1, -1],\r\n# [0, 1, -1, -1, -1, -1],\r\n# [-1, -1, 2, 3, -1, -1],\r\n# [-1, -1, 2, 3, -1, -1],\r\n# [-1, -1, -1, -1, 4, 5],\r\n# [-1, -1, -1, -1, 4, 5],\r\n# ],\r\n# dtype=int64,\r\n# ),\r\n# \"qty_of_intersections\": {0: 2, 1: 2, 2: 1, 3: 1, 4: 1, 5: 1},\r\n# \"arrays_with_id\": array(\r\n# [\r\n# [0, 1, 2, 0],\r\n# [0, 3, 4, 1],\r\n# [5, 6, -1, -1],\r\n# [6, 8, 9, -1],\r\n# [10, 11, -1, -1],\r\n# [11, 12, -1, -1],\r\n# ],\r\n# dtype=int8,\r\n# ),\r\n# \"different_values\": 13,\r\n# \"mapped_ids\": {\r\n# 0: 5,\r\n# 1: 3,\r\n# 2: 4,\r\n# 3: 11,\r\n# 4: 12,\r\n# 5: 52,\r\n# 6: 34,\r\n# 7: \"DUMMYVAL\",\r\n# 8: 111,\r\n# 9: 112,\r\n# 10: 1000,\r\n# 11: 300,\r\n# 12: 5000,\r\n# },\r\n# }\r\n\r\n\r\nlist_ = [\r\n[5, 3, 4, 5],\r\n[5, 11, 12, 3],\r\n[52, 34],\r\n[34, 111, 112],\r\n[1000, 300, 34],\r\n[300, 5000],\r\n]\r\ninters = find_intersection_of_lists(list_)\r\nprint(inters)\r\n\r\n\r\n# {\r\n# \"direct_intersections\": {\r\n# 0: array([1], dtype=int64),\r\n# 1: array([0], dtype=int64),\r\n# 2: array([3, 4], dtype=int64),\r\n# 3: array([2, 4], dtype=int64),\r\n# 4: array([2, 3, 5], dtype=int64),\r\n# 5: array([4], dtype=int64),\r\n# },\r\n# \"nested_intersections\": array(\r\n# [\r\n# [0, 1, -1, -1, -1, -1],\r\n# [0, 1, -1, -1, -1, -1],\r\n# [-1, -1, 2, 3, 4, 5],\r\n# [-1, -1, 2, 3, 4, 5],\r\n# [-1, -1, 2, 3, 4, 5],\r\n# [-1, -1, 2, 3, 4, 5],\r\n# ],\r\n# dtype=int64,\r\n# ),\r\n# \"qty_of_intersections\": {0: 2, 1: 2, 2: 2, 3: 2, 4: 3, 5: 1},\r\n# \"arrays_with_id\": array(\r\n# [\r\n# [0, 1, 2, 0],\r\n# [0, 3, 4, 1],\r\n# [5, 6, -1, -1],\r\n# [6, 8, 9, -1],\r\n# [10, 11, 6, -1],\r\n# [11, 12, -1, -1],\r\n# ],\r\n# dtype=int8,\r\n# ),\r\n# \"different_values\": 13,\r\n# \"mapped_ids\": {\r\n# 0: 5,\r\n# 1: 3,\r\n# 2: 4,\r\n# 3: 11,\r\n# 4: 12,\r\n# 5: 52,\r\n# 6: 34,\r\n# 7: \"DUMMYVAL\",\r\n# 8: 111,\r\n# 9: 112,\r\n# 10: 1000,\r\n# 11: 300,\r\n# 12: 5000,\r\n# },\r\n# }\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "finds direct and nested intersections of lists",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/cythonintersectgroupercython"
},
"split_keywords": [
"intersection",
"group"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "911012bb5c2249564817d8b1a4335db18592514ce9e417dfff1eb82836f517cd",
"md5": "d16e719df69a5c86d589f8a6a0b9337a",
"sha256": "834587e0b03ded0857e61a6e70cc7a4c1ea019a1fdd54513c8ab15b8943c364b"
},
"downloads": -1,
"filename": "cythonintersectgroupercython-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d16e719df69a5c86d589f8a6a0b9337a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 27697,
"upload_time": "2024-02-07T08:41:13",
"upload_time_iso_8601": "2024-02-07T08:41:13.272238Z",
"url": "https://files.pythonhosted.org/packages/91/10/12bb5c2249564817d8b1a4335db18592514ce9e417dfff1eb82836f517cd/cythonintersectgroupercython-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b2e02c79a6c7fa6a0fc5279a498bd574ce76874a30ce6a151f70c249103a4418",
"md5": "999b1f3202ca8e193c0d990d8ece3d2e",
"sha256": "93ff892584f146244a1ecb6456aea951f6eeef1884e2d8c159b40c8787a2f6d5"
},
"downloads": -1,
"filename": "cythonintersectgroupercython-0.10.tar.gz",
"has_sig": false,
"md5_digest": "999b1f3202ca8e193c0d990d8ece3d2e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26936,
"upload_time": "2024-02-07T08:41:16",
"upload_time_iso_8601": "2024-02-07T08:41:16.147832Z",
"url": "https://files.pythonhosted.org/packages/b2/e0/2c79a6c7fa6a0fc5279a498bd574ce76874a30ce6a151f70c249103a4418/cythonintersectgroupercython-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-07 08:41:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "cythonintersectgroupercython",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "cythonintersectgroupercython"
}