numpy-indexed-fedeful


Namenumpy-indexed-fedeful JSON
Version 0.0.0 PyPI version JSON
download
home_pagehttps://github.com/EelcoHoogendoorn/Numpy_arraysetops_EP
SummaryThis package contains functionality for indexed operations on numpy ndarrays, providing efficient vectorized functionality such as grouping and set operations.
upload_time2023-02-07 21:35:13
maintainer
docs_urlNone
authorEelco Hoogendoorn
requires_python
licenseFreely Distributable
keywords numpy group_by set-operations indexing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            |Travis| |PyPI| |Anaconda|

Numpy indexed operations
========================

This package contains functionality for indexed operations on numpy ndarrays, providing efficient vectorized functionality such as grouping and set operations.

* Rich and efficient grouping functionality:

  - splitting of values by key-group
  - reductions of values by key-group

* Generalization of existing array set operation to nd-arrays, such as:

  - unique
  - union
  - difference
  - exclusive (xor)
  - contains / in (in1d)

* Some new functions:

  - indices: numpy equivalent of list.index
  - count: numpy equivalent of collections.Counter
  - mode: find the most frequently occuring items in a set
  - multiplicity: number of occurrences of each key in a sequence
  - count\_table: like R's table or pandas crosstab, or an ndim version of np.bincount

Some brief examples to give an impression hereof:

.. code:: python

    # three sets of graph edges (doublet of ints)
    edges = np.random.randint(0, 9, (3, 100, 2))
    # find graph edges exclusive to one of three sets
    ex = exclusive(*edges)
    print(ex)
    # which edges are exclusive to the first set?
    print(contains(edges[0], ex))
    # where are the exclusive edges relative to the totality of them?
    print(indices(union(*edges), ex))
    # group and reduce values by identical keys
    values = np.random.rand(100, 20)
    # and so on...
    print(group_by(edges[0]).median(values))

Installation
------------

.. code:: python

    > conda install numpy-indexed -c conda-forge

or

.. code:: python

    > pip install numpy-indexed

See: https://pypi.python.org/pypi/numpy-indexed

Design decisions:
-----------------

This package builds upon a generalization of the design pattern as can
be found in numpy.unique. That is, by argsorting an ndarray, many
subsequent operations can be implemented efficiently and in a vectorized
manner.

The sorting and related low level operations are encapsulated into a
hierarchy of Index classes, which allows for efficient lookup of many
properties for a variety of different key-types. The public API of this
package is a quite thin wrapper around these Index objects.

The two complex key types currently supported, beyond standard sequences
of sortable primitive types, are ndarray keys (i.e, finding unique
rows/columns of an array) and composite keys (zipped sequences). For the
exact casting rules describing valid sequences of key objects to index
objects, see as\_index().

Todo and open questions:
------------------------

- There may be further generalizations that could be built on top of
  these abstractions. merge/join functionality perhaps?

.. |Travis| image:: https://travis-ci.org/EelcoHoogendoorn/Numpy_arraysetops_EP.svg?branch=master
   :target: https://travis-ci.org/EelcoHoogendoorn/Numpy_arraysetops_EP
.. |PyPI| image:: https://badge.fury.io/py/numpy-indexed.svg
   :target: https://pypi.org/project/numpy-indexed/
.. |Anaconda| image:: https://anaconda.org/conda-forge/numpy-indexed/badges/version.svg
   :target: https://anaconda.org/conda-forge/numpy-indexed

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/EelcoHoogendoorn/Numpy_arraysetops_EP",
    "name": "numpy-indexed-fedeful",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "numpy group_by set-operations indexing",
    "author": "Eelco Hoogendoorn",
    "author_email": "hoogendoorn.eelco@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/51/06/eb9ac65276e933a7283655566618198bf0de377a87dc30af6f452dd6b3d3/numpy-indexed-fedeful-0.0.0.tar.gz",
    "platform": "Any",
    "description": "|Travis| |PyPI| |Anaconda|\n\nNumpy indexed operations\n========================\n\nThis package contains functionality for indexed operations on numpy ndarrays, providing efficient vectorized functionality such as grouping and set operations.\n\n* Rich and efficient grouping functionality:\n\n  - splitting of values by key-group\n  - reductions of values by key-group\n\n* Generalization of existing array set operation to nd-arrays, such as:\n\n  - unique\n  - union\n  - difference\n  - exclusive (xor)\n  - contains / in (in1d)\n\n* Some new functions:\n\n  - indices: numpy equivalent of list.index\n  - count: numpy equivalent of collections.Counter\n  - mode: find the most frequently occuring items in a set\n  - multiplicity: number of occurrences of each key in a sequence\n  - count\\_table: like R's table or pandas crosstab, or an ndim version of np.bincount\n\nSome brief examples to give an impression hereof:\n\n.. code:: python\n\n    # three sets of graph edges (doublet of ints)\n    edges = np.random.randint(0, 9, (3, 100, 2))\n    # find graph edges exclusive to one of three sets\n    ex = exclusive(*edges)\n    print(ex)\n    # which edges are exclusive to the first set?\n    print(contains(edges[0], ex))\n    # where are the exclusive edges relative to the totality of them?\n    print(indices(union(*edges), ex))\n    # group and reduce values by identical keys\n    values = np.random.rand(100, 20)\n    # and so on...\n    print(group_by(edges[0]).median(values))\n\nInstallation\n------------\n\n.. code:: python\n\n    > conda install numpy-indexed -c conda-forge\n\nor\n\n.. code:: python\n\n    > pip install numpy-indexed\n\nSee: https://pypi.python.org/pypi/numpy-indexed\n\nDesign decisions:\n-----------------\n\nThis package builds upon a generalization of the design pattern as can\nbe found in numpy.unique. That is, by argsorting an ndarray, many\nsubsequent operations can be implemented efficiently and in a vectorized\nmanner.\n\nThe sorting and related low level operations are encapsulated into a\nhierarchy of Index classes, which allows for efficient lookup of many\nproperties for a variety of different key-types. The public API of this\npackage is a quite thin wrapper around these Index objects.\n\nThe two complex key types currently supported, beyond standard sequences\nof sortable primitive types, are ndarray keys (i.e, finding unique\nrows/columns of an array) and composite keys (zipped sequences). For the\nexact casting rules describing valid sequences of key objects to index\nobjects, see as\\_index().\n\nTodo and open questions:\n------------------------\n\n- There may be further generalizations that could be built on top of\n  these abstractions. merge/join functionality perhaps?\n\n.. |Travis| image:: https://travis-ci.org/EelcoHoogendoorn/Numpy_arraysetops_EP.svg?branch=master\n   :target: https://travis-ci.org/EelcoHoogendoorn/Numpy_arraysetops_EP\n.. |PyPI| image:: https://badge.fury.io/py/numpy-indexed.svg\n   :target: https://pypi.org/project/numpy-indexed/\n.. |Anaconda| image:: https://anaconda.org/conda-forge/numpy-indexed/badges/version.svg\n   :target: https://anaconda.org/conda-forge/numpy-indexed\n",
    "bugtrack_url": null,
    "license": "Freely Distributable",
    "summary": "This package contains functionality for indexed operations on numpy ndarrays, providing efficient vectorized functionality such as grouping and set operations.",
    "version": "0.0.0",
    "split_keywords": [
        "numpy",
        "group_by",
        "set-operations",
        "indexing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0788363cbc373ec08149a592d5401f1a4ec8289554530dceaa8928c6353a1a17",
                "md5": "785b047fbb8a584c131af005e8673a45",
                "sha256": "16c26e81cdaf2726703f0e00a0a681211e394e2ec027a740534b8ce5159233ad"
            },
            "downloads": -1,
            "filename": "numpy_indexed_fedeful-0.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "785b047fbb8a584c131af005e8673a45",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 19781,
            "upload_time": "2023-02-07T21:35:11",
            "upload_time_iso_8601": "2023-02-07T21:35:11.803693Z",
            "url": "https://files.pythonhosted.org/packages/07/88/363cbc373ec08149a592d5401f1a4ec8289554530dceaa8928c6353a1a17/numpy_indexed_fedeful-0.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5106eb9ac65276e933a7283655566618198bf0de377a87dc30af6f452dd6b3d3",
                "md5": "702ab6a746b1f776f4004b80d57b03d0",
                "sha256": "a2f0eaec484cf9d46137279cd236026a6f478dbb992a14bcfb44a92a28350690"
            },
            "downloads": -1,
            "filename": "numpy-indexed-fedeful-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "702ab6a746b1f776f4004b80d57b03d0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21486,
            "upload_time": "2023-02-07T21:35:13",
            "upload_time_iso_8601": "2023-02-07T21:35:13.463874Z",
            "url": "https://files.pythonhosted.org/packages/51/06/eb9ac65276e933a7283655566618198bf0de377a87dc30af6f452dd6b3d3/numpy-indexed-fedeful-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-07 21:35:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "EelcoHoogendoorn",
    "github_project": "Numpy_arraysetops_EP",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "appveyor": true,
    "lcname": "numpy-indexed-fedeful"
}
        
Elapsed time: 0.13200s