duplicateindexer


Nameduplicateindexer JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/duplicateindexer
SummaryFind duplicates in multiple lists and return their indices and values.
upload_time2023-09-13 02:28:06
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords find duplicates
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Find duplicates in multiple lists and return their indices and values.

## Tested against Windows 10 / Python 3.10 / Anaconda

### pip install duplicateindexer


Find duplicates in multiple lists and return their indices and values.

This function takes multiple lists as input and finds the common elements among them.
It then returns a list of dictionaries, where each dictionary corresponds to a common element.
Each dictionary contains keys for the input lists (0, 1, 2, ...), and the values are nested dictionaries.
These nested dictionaries have keys 'indices' and 'value', which represent the indices of the common
element in the input lists and the values of that common element in the input lists, respectively.



```python

Args:
	*args: Multiple lists containing elements to be compared.

Returns:
	List of dictionaries, where each dictionary represents a common element and its indices and values
	in the input lists.

Examples:
	>>> aa = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
	>>> bb = [
	...     [1, 2, 3],
	...     [4, 5, 6],
	...     [7, 8, 9],
	...     [10, 11, 12],
	...     [13, 14, 15],
	...     [1, 2, 3],
	...     [4, 5, 6],
	...     [7, 8, 9],
	...     [10, 11, 12],
	...     [13, 14, 15],
	... ]
	>>> l = find_duplicates_in_multiple_lists(aa, bb)
	>>> print(l)
	[
		{
			0: {
				0: {'indices': [1], 'value': [4, 5, 6]},
				1: {'indices': [1, 6], 'value': [4, 5, 6]}
			}
		},
		{
			1: {
				0: {'indices': [0], 'value': [1, 2, 3]},
				1: {'indices': [0, 5], 'value': [1, 2, 3]}
			}
		},
		{
			2: {
				0: {'indices': [2], 'value': [7, 8, 9]},
				1: {'indices': [2, 7], 'value': [7, 8, 9]}
			}
		},
		{
			3: {
				0: {'indices': [3], 'value': [10, 11, 12]},
				1: {'indices': [3, 8], 'value': [10, 11, 12]}
			}
		}
	]

	>>> cc = list(range(1, 20))
	>>> dd = list(range(11, 30))
	>>> l1 = find_duplicates_in_multiple_lists(cc, dd)
	>>> print(l1)
	[
		{0: {0: {'indices': [10], 'value': 11}, 1: {'indices': [0], 'value': 11}}},
		{1: {0: {'indices': [11], 'value': 12}, 1: {'indices': [1], 'value': 12}}},
		{2: {0: {'indices': [12], 'value': 13}, 1: {'indices': [2], 'value': 13}}},
		{3: {0: {'indices': [13], 'value': 14}, 1: {'indices': [3], 'value': 14}}},
		{4: {0: {'indices': [14], 'value': 15}, 1: {'indices': [4], 'value': 15}}},
		{5: {0: {'indices': [15], 'value': 16}, 1: {'indices': [5], 'value': 16}}},
		{6: {0: {'indices': [16], 'value': 17}, 1: {'indices': [6], 'value': 17}}},
		{7: {0: {'indices': [17], 'value': 18}, 1: {'indices': [7], 'value': 18}}},
		{8: {0: {'indices': [18], 'value': 19}, 1: {'indices': [8], 'value': 19}}}
	]
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/duplicateindexer",
    "name": "duplicateindexer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "find,duplicates",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/c0/4d6cb7c01ff9459f52a969e292eb989e23782338b9ad5148799a1a4b2fa1/duplicateindexer-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# Find duplicates in multiple lists and return their indices and values.\r\n\r\n## Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n### pip install duplicateindexer\r\n\r\n\r\nFind duplicates in multiple lists and return their indices and values.\r\n\r\nThis function takes multiple lists as input and finds the common elements among them.\r\nIt then returns a list of dictionaries, where each dictionary corresponds to a common element.\r\nEach dictionary contains keys for the input lists (0, 1, 2, ...), and the values are nested dictionaries.\r\nThese nested dictionaries have keys 'indices' and 'value', which represent the indices of the common\r\nelement in the input lists and the values of that common element in the input lists, respectively.\r\n\r\n\r\n\r\n```python\r\n\r\nArgs:\r\n\t*args: Multiple lists containing elements to be compared.\r\n\r\nReturns:\r\n\tList of dictionaries, where each dictionary represents a common element and its indices and values\r\n\tin the input lists.\r\n\r\nExamples:\r\n\t>>> aa = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]\r\n\t>>> bb = [\r\n\t...     [1, 2, 3],\r\n\t...     [4, 5, 6],\r\n\t...     [7, 8, 9],\r\n\t...     [10, 11, 12],\r\n\t...     [13, 14, 15],\r\n\t...     [1, 2, 3],\r\n\t...     [4, 5, 6],\r\n\t...     [7, 8, 9],\r\n\t...     [10, 11, 12],\r\n\t...     [13, 14, 15],\r\n\t... ]\r\n\t>>> l = find_duplicates_in_multiple_lists(aa, bb)\r\n\t>>> print(l)\r\n\t[\r\n\t\t{\r\n\t\t\t0: {\r\n\t\t\t\t0: {'indices': [1], 'value': [4, 5, 6]},\r\n\t\t\t\t1: {'indices': [1, 6], 'value': [4, 5, 6]}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\t1: {\r\n\t\t\t\t0: {'indices': [0], 'value': [1, 2, 3]},\r\n\t\t\t\t1: {'indices': [0, 5], 'value': [1, 2, 3]}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\t2: {\r\n\t\t\t\t0: {'indices': [2], 'value': [7, 8, 9]},\r\n\t\t\t\t1: {'indices': [2, 7], 'value': [7, 8, 9]}\r\n\t\t\t}\r\n\t\t},\r\n\t\t{\r\n\t\t\t3: {\r\n\t\t\t\t0: {'indices': [3], 'value': [10, 11, 12]},\r\n\t\t\t\t1: {'indices': [3, 8], 'value': [10, 11, 12]}\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n\r\n\t>>> cc = list(range(1, 20))\r\n\t>>> dd = list(range(11, 30))\r\n\t>>> l1 = find_duplicates_in_multiple_lists(cc, dd)\r\n\t>>> print(l1)\r\n\t[\r\n\t\t{0: {0: {'indices': [10], 'value': 11}, 1: {'indices': [0], 'value': 11}}},\r\n\t\t{1: {0: {'indices': [11], 'value': 12}, 1: {'indices': [1], 'value': 12}}},\r\n\t\t{2: {0: {'indices': [12], 'value': 13}, 1: {'indices': [2], 'value': 13}}},\r\n\t\t{3: {0: {'indices': [13], 'value': 14}, 1: {'indices': [3], 'value': 14}}},\r\n\t\t{4: {0: {'indices': [14], 'value': 15}, 1: {'indices': [4], 'value': 15}}},\r\n\t\t{5: {0: {'indices': [15], 'value': 16}, 1: {'indices': [5], 'value': 16}}},\r\n\t\t{6: {0: {'indices': [16], 'value': 17}, 1: {'indices': [6], 'value': 17}}},\r\n\t\t{7: {0: {'indices': [17], 'value': 18}, 1: {'indices': [7], 'value': 18}}},\r\n\t\t{8: {0: {'indices': [18], 'value': 19}, 1: {'indices': [8], 'value': 19}}}\r\n\t]\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Find duplicates in multiple lists and return their indices and values.",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/duplicateindexer"
    },
    "split_keywords": [
        "find",
        "duplicates"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c33b46e3d5da7c95b6c7b0710e958cee03a97870485288b8d1478aac36f6bc43",
                "md5": "9d1e0fbd02589cf9060305addf921394",
                "sha256": "abecd9528b0739f163eb4281847c4c1e4d220004658cbb578f882c38dbbb8ad6"
            },
            "downloads": -1,
            "filename": "duplicateindexer-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d1e0fbd02589cf9060305addf921394",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6377,
            "upload_time": "2023-09-13T02:28:04",
            "upload_time_iso_8601": "2023-09-13T02:28:04.838192Z",
            "url": "https://files.pythonhosted.org/packages/c3/3b/46e3d5da7c95b6c7b0710e958cee03a97870485288b8d1478aac36f6bc43/duplicateindexer-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8c04d6cb7c01ff9459f52a969e292eb989e23782338b9ad5148799a1a4b2fa1",
                "md5": "9e943ffb3841e6e3c276f24ecb4c2609",
                "sha256": "414cd47c33d027e00cc4bf4bc3212fc9c68e0c0ba0bcba810645ab888244e854"
            },
            "downloads": -1,
            "filename": "duplicateindexer-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "9e943ffb3841e6e3c276f24ecb4c2609",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4275,
            "upload_time": "2023-09-13T02:28:06",
            "upload_time_iso_8601": "2023-09-13T02:28:06.817200Z",
            "url": "https://files.pythonhosted.org/packages/c8/c0/4d6cb7c01ff9459f52a969e292eb989e23782338b9ad5148799a1a4b2fa1/duplicateindexer-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-13 02:28:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "duplicateindexer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "duplicateindexer"
}
        
Elapsed time: 0.11473s