piso


Namepiso JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/staircase-dev/piso
SummaryPandas Interval Set Operations: methods for set operations, analytics, lookups and joins on pandas' Interval, IntervalArray and IntervalIndex
upload_time2023-07-06 11:10:26
maintainerRiley Clement
docs_urlNone
authorRiley Clement
requires_python>=3.7,<4.0
licenseMIT
keywords piso pandas set set operations interval intervalarray intervalindex data analysis analysis data structures
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center"><a href="https://github.com/staircase-dev/piso"><img src="https://github.com/staircase-dev/piso/blob/master/docs/img/piso_social_transparent.svg" title="piso logo" alt="piso logo"></a></p>

<p align="center">
    <a href="https://www.python.org/" alt="Python version">
        <img src="https://img.shields.io/pypi/pyversions/piso" /></a>
    <a href="https://pypi.org/project/piso/" alt="PyPI version">
        <img src="https://img.shields.io/pypi/v/piso" /></a>
    <a href="https://anaconda.org/conda-forge/piso" alt="Conda Forge version">
        <img src="https://anaconda.org/conda-forge/piso/badges/version.svg?branch=master&kill_cache=1" /></a>
	<a href="https://github.com/staircase-dev/piso/actions/workflows/ci.yml" alt="Github CI">
		<img src="https://github.com/staircase-dev/piso/actions/workflows/ci.yml/badge.svg"/></a>
    <a href="https://piso.readthedocs.io" alt="Documentation">
        <img src="https://readthedocs.org/projects/piso/badge/?version=latest" /></a>
</p>

# piso - pandas interval set operations

**piso** exists to bring set operations (union, intersection, difference + more), analytical methods, and lookup and join functionality to [pandas'](https://pandas.pydata.org/) interval classes, specifically

    - pandas.Interval
    - pandas.arrays.IntervalArray
    - pandas.IntervalIndex

Currently, there is a lack of such functionality in pandas, although it has been earmarked for development.  Until this eventuates, piso aims to fill the void.  Many of the methods can be used via accessors, which can be registered to `pandas.arrays.IntervalArray` and `pandas.IntervalIndex` classes, for example:

```python
>>> import pandas as pd
>>> import piso
>>> piso.register_accessors()

>>> arr = pd.arrays.IntervalArray.from_tuples(
...        [(1,5), (3,6), (2,4)]
...    )

>>> arr.piso.intersection()
<IntervalArray>
[(3, 4]]
Length: 1, closed: right, dtype: interval[int64]

>>> arr.piso.contains([2, 3, 5])
            2      3      5
(1, 5]   True   True   True
(3, 6]  False  False   True
(2, 4]  False   True  False

>>> df = pd.DataFrame(
...     {"A":[4,3], "B":["x","y"]},
...     index=pd.IntervalIndex.from_tuples([(1,3), (5,7)]),
... )

>>> s = pd.Series(
...     [True, False],
...     index=pd.IntervalIndex.from_tuples([(2,4), (5,6)]),
...     name="C",
... )

>>> piso.join(df, s)
        A  B      C
(1, 2]  4  x    NaN
(2, 3]  4  x   True
(5, 6]  3  y  False
(6, 7]  3  y    NaN

>>> piso.join(df, s, how="inner")
        A  B      C
(2, 3]  4  x   True
(5, 6]  3  y  False
```

The domain of the intervals can be either numerical, `pandas.Timestamp` or `pandas.Timedelta`.

Several [case studies](https://piso.readthedocs.io/en/latest/user_guide/case_studies/index.html) using piso can be found in the [user guide](https://piso.readthedocs.io/en/latest/user_guide/index.html).  Further examples, and a detailed explanation of functionality, are provided in the [API reference](https://piso.readthedocs.io/en/latest/reference/index.html).

Visit [https://piso.readthedocs.io](https://piso.readthedocs.io/) for the documentation.

## Installation

`piso` can be installed from PyPI or Anaconda.

To install the latest version from PyPI::

```sh
python -m pip install piso
```

To install the latest version through conda-forge::

```sh
conda install -c conda-forge piso
```

## Versioning

[SemVer](http://semver.org/) is used by piso for versioning releases.  For versions available, see the [tags on this repository](https://github.com/staircase-dev/piso/tags).

## License

This project is licensed under the [MIT License](https://github.com/staircase-dev/piso/blob/master/LICENSE)

## Acknowledgments

Currently, piso is a pure-python implentation which relies heavily on [staircase](https://www.staircase.dev) and [pandas](https://pandas.pydata.org/).  It is designed to operate as part of the *pandas ecosystem*.  The colours for the piso logo have been assimilated from pandas as a homage, and is not to intended to imply and affiliation with, or endorsement by, pandas.

Additionally, two classes have been borrowed, almost verbatim, from the pandas source code:

    - `pandas.util._decorators.Appender`
    - `pandas.core.accessor.CachedAccessor`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/staircase-dev/piso",
    "name": "piso",
    "maintainer": "Riley Clement",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "venaturum@gmail.com",
    "keywords": "piso,pandas,set,set operations,interval,IntervalArray,IntervalIndex,Data Analysis,Analysis,Data Structures",
    "author": "Riley Clement",
    "author_email": "venaturum@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bf/2a/1db1f064b72ab082a137bf8e3ea164d32f19c70beb0258191ef25d2cd043/piso-1.0.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\"><a href=\"https://github.com/staircase-dev/piso\"><img src=\"https://github.com/staircase-dev/piso/blob/master/docs/img/piso_social_transparent.svg\" title=\"piso logo\" alt=\"piso logo\"></a></p>\n\n<p align=\"center\">\n    <a href=\"https://www.python.org/\" alt=\"Python version\">\n        <img src=\"https://img.shields.io/pypi/pyversions/piso\" /></a>\n    <a href=\"https://pypi.org/project/piso/\" alt=\"PyPI version\">\n        <img src=\"https://img.shields.io/pypi/v/piso\" /></a>\n    <a href=\"https://anaconda.org/conda-forge/piso\" alt=\"Conda Forge version\">\n        <img src=\"https://anaconda.org/conda-forge/piso/badges/version.svg?branch=master&kill_cache=1\" /></a>\n\t<a href=\"https://github.com/staircase-dev/piso/actions/workflows/ci.yml\" alt=\"Github CI\">\n\t\t<img src=\"https://github.com/staircase-dev/piso/actions/workflows/ci.yml/badge.svg\"/></a>\n    <a href=\"https://piso.readthedocs.io\" alt=\"Documentation\">\n        <img src=\"https://readthedocs.org/projects/piso/badge/?version=latest\" /></a>\n</p>\n\n# piso - pandas interval set operations\n\n**piso** exists to bring set operations (union, intersection, difference + more), analytical methods, and lookup and join functionality to [pandas'](https://pandas.pydata.org/) interval classes, specifically\n\n    - pandas.Interval\n    - pandas.arrays.IntervalArray\n    - pandas.IntervalIndex\n\nCurrently, there is a lack of such functionality in pandas, although it has been earmarked for development.  Until this eventuates, piso aims to fill the void.  Many of the methods can be used via accessors, which can be registered to `pandas.arrays.IntervalArray` and `pandas.IntervalIndex` classes, for example:\n\n```python\n>>> import pandas as pd\n>>> import piso\n>>> piso.register_accessors()\n\n>>> arr = pd.arrays.IntervalArray.from_tuples(\n...        [(1,5), (3,6), (2,4)]\n...    )\n\n>>> arr.piso.intersection()\n<IntervalArray>\n[(3, 4]]\nLength: 1, closed: right, dtype: interval[int64]\n\n>>> arr.piso.contains([2, 3, 5])\n            2      3      5\n(1, 5]   True   True   True\n(3, 6]  False  False   True\n(2, 4]  False   True  False\n\n>>> df = pd.DataFrame(\n...     {\"A\":[4,3], \"B\":[\"x\",\"y\"]},\n...     index=pd.IntervalIndex.from_tuples([(1,3), (5,7)]),\n... )\n\n>>> s = pd.Series(\n...     [True, False],\n...     index=pd.IntervalIndex.from_tuples([(2,4), (5,6)]),\n...     name=\"C\",\n... )\n\n>>> piso.join(df, s)\n        A  B      C\n(1, 2]  4  x    NaN\n(2, 3]  4  x   True\n(5, 6]  3  y  False\n(6, 7]  3  y    NaN\n\n>>> piso.join(df, s, how=\"inner\")\n        A  B      C\n(2, 3]  4  x   True\n(5, 6]  3  y  False\n```\n\nThe domain of the intervals can be either numerical, `pandas.Timestamp` or `pandas.Timedelta`.\n\nSeveral [case studies](https://piso.readthedocs.io/en/latest/user_guide/case_studies/index.html) using piso can be found in the [user guide](https://piso.readthedocs.io/en/latest/user_guide/index.html).  Further examples, and a detailed explanation of functionality, are provided in the [API reference](https://piso.readthedocs.io/en/latest/reference/index.html).\n\nVisit [https://piso.readthedocs.io](https://piso.readthedocs.io/) for the documentation.\n\n## Installation\n\n`piso` can be installed from PyPI or Anaconda.\n\nTo install the latest version from PyPI::\n\n```sh\npython -m pip install piso\n```\n\nTo install the latest version through conda-forge::\n\n```sh\nconda install -c conda-forge piso\n```\n\n## Versioning\n\n[SemVer](http://semver.org/) is used by piso for versioning releases.  For versions available, see the [tags on this repository](https://github.com/staircase-dev/piso/tags).\n\n## License\n\nThis project is licensed under the [MIT License](https://github.com/staircase-dev/piso/blob/master/LICENSE)\n\n## Acknowledgments\n\nCurrently, piso is a pure-python implentation which relies heavily on [staircase](https://www.staircase.dev) and [pandas](https://pandas.pydata.org/).  It is designed to operate as part of the *pandas ecosystem*.  The colours for the piso logo have been assimilated from pandas as a homage, and is not to intended to imply and affiliation with, or endorsement by, pandas.\n\nAdditionally, two classes have been borrowed, almost verbatim, from the pandas source code:\n\n    - `pandas.util._decorators.Appender`\n    - `pandas.core.accessor.CachedAccessor`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pandas Interval Set Operations: methods for set operations, analytics, lookups and joins on pandas' Interval, IntervalArray and IntervalIndex",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/staircase-dev/piso/issues",
        "Documentation": "https://piso.readthedocs.io",
        "Homepage": "https://github.com/staircase-dev/piso",
        "Repository": "https://github.com/staircase-dev/piso"
    },
    "split_keywords": [
        "piso",
        "pandas",
        "set",
        "set operations",
        "interval",
        "intervalarray",
        "intervalindex",
        "data analysis",
        "analysis",
        "data structures"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "798974d5515bbf7d7db78fd3766abdce34ab61a64ee922359f67709bbd91efb2",
                "md5": "08e26eb2fd0dfdd30fe044d48f8a252a",
                "sha256": "855d36bf9ef819fd890ad5125cc18cf1b367490b1415ce07938c6e273e1fcb07"
            },
            "downloads": -1,
            "filename": "piso-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08e26eb2fd0dfdd30fe044d48f8a252a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 27803,
            "upload_time": "2023-07-06T11:10:24",
            "upload_time_iso_8601": "2023-07-06T11:10:24.750233Z",
            "url": "https://files.pythonhosted.org/packages/79/89/74d5515bbf7d7db78fd3766abdce34ab61a64ee922359f67709bbd91efb2/piso-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf2a1db1f064b72ab082a137bf8e3ea164d32f19c70beb0258191ef25d2cd043",
                "md5": "ffce56be257f368de399cc071476cd62",
                "sha256": "5d6a09765882a5dd481173a61d58668b063a7299d03ec9aced3b41fdf80aa680"
            },
            "downloads": -1,
            "filename": "piso-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ffce56be257f368de399cc071476cd62",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 24081,
            "upload_time": "2023-07-06T11:10:26",
            "upload_time_iso_8601": "2023-07-06T11:10:26.429691Z",
            "url": "https://files.pythonhosted.org/packages/bf/2a/1db1f064b72ab082a137bf8e3ea164d32f19c70beb0258191ef25d2cd043/piso-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-06 11:10:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "staircase-dev",
    "github_project": "piso",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "piso"
}
        
Elapsed time: 0.08506s