{ "info": { "author": "Jan Greis", "author_email": "janrg@users.noreply.github.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Utilities" ], "description": "multidirmap\n===========\n\nMultidirectional map where an arbitrary number of columns can be used as keys.\n\nStatus\n------\n\n.. image:: https://readthedocs.org/projects/multidirmap/badge/?style=flat\n :target: https://readthedocs.org/projects/multidirmap\n :alt: Documentation Status\n\n.. image:: https://travis-ci.org/janrg/multidirmap.svg?branch=master\n :alt: Travis-CI Build Status\n :target: https://travis-ci.org/janrg/multidirmap\n\n.. image:: https://ci.appveyor.com/api/projects/status/github/janrg/multidirmap?branch=master&svg=true\n :alt: AppVeyor Build Status\n :target: https://ci.appveyor.com/project/janrg/multidirmap\n\n.. image:: https://codecov.io/github/janrg/multidirmap/coverage.svg?branch=master\n :alt: Coverage Status\n :target: https://codecov.io/github/janrg/multidirmap\n\n.. image:: https://img.shields.io/pypi/v/multidirmap.svg\n :alt: PyPI Package latest release\n :target: https://pypi.org/project/multidirmap/\n\n.. image:: https://img.shields.io/pypi/wheel/multidirmap.svg\n :alt: PyPI Wheel\n :target: https://pypi.org/project/multidirmap/\n\n.. image:: https://img.shields.io/pypi/pyversions/multidirmap.svg\n :alt: Supported versions\n :target: https://pypi.org/project/multidirmap/\n\n.. image:: https://img.shields.io/pypi/implementation/multidirmap.svg\n :alt: Supported implementations\n :target: https://pypi.org/project/multidirmap/\n\n.. image:: https://img.shields.io/pypi/l/multidirmap.svg\n :target: https://raw.githubusercontent.com/janrg/multidirmap/master/LICENSE\n :alt: License\n\nInstallation\n------------\n\n.. code-block:: bash\n\n $ pip install multidirmap\n\nDocumentation\n-------------\n\nhttps://multidirmap.readthedocs.io/en/latest/\n\nQuick Start\n-----------\n\n.. code-block:: python\n\n >>> from multidirmap import MultiDirMap\n >>> crew = MultiDirMap(\n [\"character\", \"portrayed_by\", \"role\", \"nicknames\"],\n key_columns=2,\n data=[[\"Malcolm Reynolds\", \"Nathan Fillion\", \"Captain\", [\"Mal\", \"Captain Tight Pants\"]],\n [\"Zo\u00eb Washburne\", \"Gina Torres\", \"First Mate\"],\n [\"Hoban Washburne\", \"Alan Tudyk\", \"Pilot\", \"Wash\"]])\n >>> crew[\"Malcolm Reynolds\"].role\n Captain\n >>> crew.portrayed_by[\"Nathan Fillion\"].nicknames\n [\"Mal\", \"Captain Tight Pants\"]\n\nFeatures\n--------\n\n- As many columns as desired can be used as key columns for the mapping\n- O(1) retrieval from any key column\n- Internal consistency is maintained through any modifications to the contents\n- Insertion order is maintained in the primary key column\n- Built-in pretty printing of the mapping\n\nUse Cases\n---------\n\nDictionaries are ubiquitous in Pyton and provide an extremely useful and fast\nmapping from keys to values. Sometimes, a single, uni-directional mapping is not\nenough, though, and while `bidict `__ extends\nthis functionality to a bidirectional mapping, *multidirmap* provides an\narray-like datastructure where any number of columns can be used for O(1)\nretrieval. In its simplest implementation (2 columns, one of which is a key\ncolumn), it essentially provides the same functionality as a dict, albeit with\nadditional overhead (don't do that...). 2 columns that are both key columns\nwill behave somewhat like a bidict, albeit with slightly different syntax. But\n*multidirmap* is significantly more flexible in that any number of key and\nnon-key columns can be used.\nA somewhat similar effect could be achieved with pandas DataFrames, though these\n(1) will not ensure uniqueness of keys, hence a retrieval may return any number\nof rows, (2) use an array structure, hence retrieval is O(n) which for large\narrays can get *very* slow, and (3) require the installation of pandas, which\nis a rather large library to include just for this feature.\n\nSay we want to work with information from the Periodic Table of Elements, like\n\n.. code-block:: python\n\n [[\"H\", \"Hydrogen\", 1, [1, 2, 3]],\n [\"He\", \"Helium\", 2, [4, 3]],\n [\"Li\", \"Lithium\", 3, [7, 6]],\n ...\n [\"Og\", \"Oganesson\", 118, [295, 294]]]\n\nwhere the columns indicate symbol, name, atomic number, and nucleon numbers of\nisotopes respectively. The first three columns are obvious candidates for key\ncolumns as they are by definition unique. *multidirmap* allows placing this\ninformation in a unified datastructure where questions like \"What are the\nisotope nucleon numbers of Lithium?\", \"What is the chemical element symbol of\nPotassium?\", or \"What is the name of the element with atomic number 46?\" can\nbe asked with a simple syntax and O(1) retrieval. Any number of additional\nkey and non-key columns could be added.\n\nThe use case that prompted the development on this package involved the *struct*\nmodule: For a binary interface I needed to convert back and forth between (1)\na string representation of the variable type, (2) an integer representation\nof the variable type, (3) the struct format char, and (4) the size in bytes of\nthe variable. Again, 1-3 are obvious candidates for key columns, with 4 being\na non-key column. Without *multidirmap*, several separate dicts have to be used\nto provide each needed mapping from one column to another and there is easy way\nto ensure that these dicts remain consistent with each other through possible\nchanges. \n\n\nChangelog\n=========\n\n0.3.0 (2019-10-03)\n------------------\n\n* ``overwrite`` now takes an enum ``Overwrite`` (backported to 2.7 via\n ``enum34``) with values ``NONE``, ``PRIMARY``, ``SECONDARY``,\n or ``ALL`` instead of string values (though the implementation is backwards\n compatible to using the old string values).\n* ``copy.copy()`` and ``copy.deepcopy()`` now work properly on a MultiDirMap\n* ``aslist()`` and ``asdict()`` on row elements renamed to ``to_list()``\n and ``to_dict()``\n* new method ``to_list()`` which returns complete map data as a list of lists\n\n0.2.0 (2019-07-12)\n------------------\n\n* Custom sorting\n* Reordering of secondary keys\n\n0.1.0 (2018-07-28)\n------------------\n\n* First release on PyPI.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/janrg/multidirmap", "keywords": "", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "multidirmap", "package_url": "https://pypi.org/project/multidirmap/", "platform": "", "project_url": "https://pypi.org/project/multidirmap/", "project_urls": { "Homepage": "https://github.com/janrg/multidirmap" }, "release_url": "https://pypi.org/project/multidirmap/0.3.0/", "requires_dist": [ "enum34 ; python_version < \"3.4\"" ], "requires_python": "", "summary": "A multidirectional map where an arbitrary number of columns can be used as keys.", "version": "0.3.0" }, "last_serial": 5929963, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5c84c7bb04384af64f3343fdb1b2a579", "sha256": "9639398495791e711c4a4954080a417e0a8f9cc8d4b92916d5b2954869905185" }, "downloads": -1, "filename": "multidirmap-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5c84c7bb04384af64f3343fdb1b2a579", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12695, "upload_time": "2018-07-28T15:37:11", "url": "https://files.pythonhosted.org/packages/7c/b6/77c34466b76ba021fd5b451d995390bb8f2526a627f55a4953447a33d389/multidirmap-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "62a3ff4da85c60ca00b629862c7e466f", "sha256": "2296d9b2f3e46e8ebbf02852d1c14a917ac03a4438801f179e1e958301030fc4" }, "downloads": -1, "filename": "multidirmap-0.1.0.tar.gz", "has_sig": false, "md5_digest": "62a3ff4da85c60ca00b629862c7e466f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27824, "upload_time": "2018-07-28T19:38:49", "url": "https://files.pythonhosted.org/packages/66/a1/9c56425588b2b637719f0913a9810f4c5f44b017dccc41278a99ffd174b5/multidirmap-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "5cb576123311130e77fdcf0c1b9db644", "sha256": "a986bc24e025aab2039aab0abc9e89953c98446b21409374a8e6f7032587afe1" }, "downloads": -1, "filename": "multidirmap-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5cb576123311130e77fdcf0c1b9db644", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11022, "upload_time": "2019-08-09T14:00:21", "url": "https://files.pythonhosted.org/packages/ec/90/f45dc7347f3af48a28fb87003114610e61d5d8c4de38020368a7e7151d00/multidirmap-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edb6a83572e867bd10133a6f8772d0eb", "sha256": "91d7d6edfc9b71b15833acb2d5c91f8298ed705743efd72c73c86bc2c48b7381" }, "downloads": -1, "filename": "multidirmap-0.2.0.tar.gz", "has_sig": false, "md5_digest": "edb6a83572e867bd10133a6f8772d0eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28723, "upload_time": "2019-08-09T14:01:53", "url": "https://files.pythonhosted.org/packages/c3/ab/de7a1f57463116efe07717a9a3eb8b8fa5d69888a3aa5a9982b8018f405f/multidirmap-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "631721805d26d5fe1e81c8730f98bc74", "sha256": "84a57461dbfe5aa5b6f23ad67fb4c8d0c9db12db968e61c2789c7f0ad420a813" }, "downloads": -1, "filename": "multidirmap-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "631721805d26d5fe1e81c8730f98bc74", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11796, "upload_time": "2019-10-04T20:00:38", "url": "https://files.pythonhosted.org/packages/9e/9a/9f80501e64d0664a33cf630fd78f8dc955edc59d7210596e0ad085eb366e/multidirmap-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "463a3409cff37b682ab556c2ba1fde7c", "sha256": "c98f23b633449e9fd4c4120d3277a22d58016ce7a1c61b7f0fb583f744a676b1" }, "downloads": -1, "filename": "multidirmap-0.3.0.tar.gz", "has_sig": false, "md5_digest": "463a3409cff37b682ab556c2ba1fde7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29472, "upload_time": "2019-10-04T20:00:40", "url": "https://files.pythonhosted.org/packages/88/ba/0704841bad8fe0bb1a2f1ae8f20e0872ea0b83377df81952b7950d85ad3f/multidirmap-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "631721805d26d5fe1e81c8730f98bc74", "sha256": "84a57461dbfe5aa5b6f23ad67fb4c8d0c9db12db968e61c2789c7f0ad420a813" }, "downloads": -1, "filename": "multidirmap-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "631721805d26d5fe1e81c8730f98bc74", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11796, "upload_time": "2019-10-04T20:00:38", "url": "https://files.pythonhosted.org/packages/9e/9a/9f80501e64d0664a33cf630fd78f8dc955edc59d7210596e0ad085eb366e/multidirmap-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "463a3409cff37b682ab556c2ba1fde7c", "sha256": "c98f23b633449e9fd4c4120d3277a22d58016ce7a1c61b7f0fb583f744a676b1" }, "downloads": -1, "filename": "multidirmap-0.3.0.tar.gz", "has_sig": false, "md5_digest": "463a3409cff37b682ab556c2ba1fde7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29472, "upload_time": "2019-10-04T20:00:40", "url": "https://files.pythonhosted.org/packages/88/ba/0704841bad8fe0bb1a2f1ae8f20e0872ea0b83377df81952b7950d85ad3f/multidirmap-0.3.0.tar.gz" } ] }