Skip to main content

Pandas Interval Set Operations: methods for set operations for pandas' Interval, IntervalArray and IntervalIndex

Project description

piso logo

piso - pandas interval set operations

piso exists to bring set operations (union, intersection, difference + more) to pandas' 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:

>>> 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]

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

A small case study using piso can be found in the user guide. Further examples, and a detailed explanation of functionality, are provided in the API reference.

Visit https://piso.readthedocs.io for the documentation.

Installation

piso can be installed from PyPI or Anaconda.

To install the latest version from PyPI::

python -m pip install piso

To install the latest version through conda-forge::

conda install -c conda-forge piso

Versioning

SemVer is used by piso for versioning releases. For versions available, see the tags on this repository.

License

This project is licensed under the MIT License

Acknowledgments

Currently, piso is a pure-python implentation which relies heavily on staircase and pandas. It is clearly 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`

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piso-0.2.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

piso-0.2.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file piso-0.2.0.tar.gz.

File metadata

  • Download URL: piso-0.2.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for piso-0.2.0.tar.gz
Algorithm Hash digest
SHA256 74babf647b2693ba93ab94c8173d67462ace4717c4c4ee81ae1ecbf2e6653607
MD5 93b5a1d284001f7421895d20ba4c70c1
BLAKE2b-256 454f1fef9058db43885bf6fcec5fb39504e739b69640eeb59b46c02314454776

See more details on using hashes here.

File details

Details for the file piso-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: piso-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for piso-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff1faa4033956e4b72dfa7ce89e8d8ed9aca77aa28dd9cb0eb2f8d5de904a2cf
MD5 959b820d9308dfcfebcd98591a075a37
BLAKE2b-256 c091ef70b19399f3514b278a8860241d18dc50b1484841c59e7c374ad656ce4f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page