pandas-indexing


Namepandas-indexing JSON
Version 0.5.0 PyPI version JSON
download
home_pageNone
SummaryHelpers to facilitate working with pandas indices in particular multiindices
upload_time2024-04-09 15:19:39
maintainerNone
docs_urlNone
authorNone
requires_python<4,>=3.8
licenseMIT
keywords pandas
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            pandas-indexing helper
======================

.. image:: https://github.com/coroa/pandas-indexing/workflows/ci/badge.svg?branch=main
    :target: https://github.com/coroa/pandas-indexing/actions?workflow=ci
    :alt: CI

.. image:: https://codecov.io/gh/coroa/pandas-indexing/branch/main/graph/badge.svg
    :target: https://codecov.io/gh/coroa/pandas-indexing
    :alt: Codecov

.. image:: https://img.shields.io/readthedocs/pandas-indexing/latest?label=Read%20the%20Docs
    :target: https://pandas-indexing.readthedocs.io/en/latest/
    :alt: Read the Docs

.. image:: https://img.shields.io/pypi/v/pandas-indexing
    :target: https://pypi.org/project/pandas-indexing/
    :alt: PyPI


Summary
-------

``pandas-indexing`` is a helpers package to make interacting with pandas multi-indices less
painful. It contains functions, that

* filter easily into multi indices: ``isin``, ``ismatch``
* add or update levels in a multiindex: ``assignlevel``
* select one or multiple specific levels: ``projectlevel``

Usage
-----

Given you have a time-series like dataframe with several multi index levels, like ``model``, ``scenario``, ``variable``:
then you can select a subset with:

.. code:: python

    df.loc[isin(model="m1", scenario=["s1", "s2"])]

or with shell like glob-patterns:

.. code:: python

    df.loc[
        ismatch(
            model="REMIND*", variable="Emissions|**", unit=["Mt CO2/yr", "kt N2O/yr"]
        )
    ]

You can overwrite index levels:

.. code:: python

    assignlevel(df, selected=1)

or project your data to only a few desired index levels:

.. code:: python

    projectlevel(df, ["model", "scenario"])


All commands are described in detail in the API reference in `documentation`_ and are
togehter with introductions for installing and using this package, but they are mostly
bare-bones atm.

Issues and Discussions
----------------------

As usual for any GitHub-based project, raise an `issue`_ if you find any bug or
want to suggest an improvement, or open a discussion if you want to discuss.


.. _PyPI: https://pypi.org
.. _latest branch: https://github.com/coroa/pandas-indexing/tree/latest
.. _master branch: https://github.com/coroa/pandas-indexing/tree/master
.. _tox: https://tox.readthedocs.io/en/latest/
.. _ReadTheDocs: https://readthedocs.org/
.. _issue: htts://github.com/coroa/pandas-indexing/issues/new
.. _documentation: https://pandas-indexing.readthedocs.io/en/latest/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pandas-indexing",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.8",
    "maintainer_email": null,
    "keywords": "pandas",
    "author": null,
    "author_email": "Jonas H\u00f6rsch <coroa@posteo.de>",
    "download_url": "https://files.pythonhosted.org/packages/b5/dd/d3ae36ea59d6b557c0f61457669f6d5371403603663a38c14a04b18c4706/pandas-indexing-0.5.0.tar.gz",
    "platform": null,
    "description": "pandas-indexing helper\n======================\n\n.. image:: https://github.com/coroa/pandas-indexing/workflows/ci/badge.svg?branch=main\n    :target: https://github.com/coroa/pandas-indexing/actions?workflow=ci\n    :alt: CI\n\n.. image:: https://codecov.io/gh/coroa/pandas-indexing/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/coroa/pandas-indexing\n    :alt: Codecov\n\n.. image:: https://img.shields.io/readthedocs/pandas-indexing/latest?label=Read%20the%20Docs\n    :target: https://pandas-indexing.readthedocs.io/en/latest/\n    :alt: Read the Docs\n\n.. image:: https://img.shields.io/pypi/v/pandas-indexing\n    :target: https://pypi.org/project/pandas-indexing/\n    :alt: PyPI\n\n\nSummary\n-------\n\n``pandas-indexing`` is a helpers package to make interacting with pandas multi-indices less\npainful. It contains functions, that\n\n* filter easily into multi indices: ``isin``, ``ismatch``\n* add or update levels in a multiindex: ``assignlevel``\n* select one or multiple specific levels: ``projectlevel``\n\nUsage\n-----\n\nGiven you have a time-series like dataframe with several multi index levels, like ``model``, ``scenario``, ``variable``:\nthen you can select a subset with:\n\n.. code:: python\n\n    df.loc[isin(model=\"m1\", scenario=[\"s1\", \"s2\"])]\n\nor with shell like glob-patterns:\n\n.. code:: python\n\n    df.loc[\n        ismatch(\n            model=\"REMIND*\", variable=\"Emissions|**\", unit=[\"Mt CO2/yr\", \"kt N2O/yr\"]\n        )\n    ]\n\nYou can overwrite index levels:\n\n.. code:: python\n\n    assignlevel(df, selected=1)\n\nor project your data to only a few desired index levels:\n\n.. code:: python\n\n    projectlevel(df, [\"model\", \"scenario\"])\n\n\nAll commands are described in detail in the API reference in `documentation`_ and are\ntogehter with introductions for installing and using this package, but they are mostly\nbare-bones atm.\n\nIssues and Discussions\n----------------------\n\nAs usual for any GitHub-based project, raise an `issue`_ if you find any bug or\nwant to suggest an improvement, or open a discussion if you want to discuss.\n\n\n.. _PyPI: https://pypi.org\n.. _latest branch: https://github.com/coroa/pandas-indexing/tree/latest\n.. _master branch: https://github.com/coroa/pandas-indexing/tree/master\n.. _tox: https://tox.readthedocs.io/en/latest/\n.. _ReadTheDocs: https://readthedocs.org/\n.. _issue: htts://github.com/coroa/pandas-indexing/issues/new\n.. _documentation: https://pandas-indexing.readthedocs.io/en/latest/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Helpers to facilitate working with pandas indices in particular multiindices",
    "version": "0.5.0",
    "project_urls": {
        "changelog": "https://github.com/coroa/pandas-indexing/blob/main/CHANGELOG.rst",
        "documentation": "https://pandas-indexing.readthedocs.io/en/latest/",
        "homepage": "https://github.com/coroa/pandas-indexing",
        "repository": "https://github.com/coroa/pandas-indexing.git"
    },
    "split_keywords": [
        "pandas"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0675e17b3abfde38b8e91c1049b07c842cdc44024c06f27ff6d5a316f492fd90",
                "md5": "85aa6c74eb4000eea457b7dc9c95f0fa",
                "sha256": "9967e9c248f6e175a6dbbf16021dfa1e23065d5358ebbd54ded09a0adb2b8b27"
            },
            "downloads": -1,
            "filename": "pandas_indexing-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "85aa6c74eb4000eea457b7dc9c95f0fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.8",
            "size": 25978,
            "upload_time": "2024-04-09T15:19:38",
            "upload_time_iso_8601": "2024-04-09T15:19:38.236013Z",
            "url": "https://files.pythonhosted.org/packages/06/75/e17b3abfde38b8e91c1049b07c842cdc44024c06f27ff6d5a316f492fd90/pandas_indexing-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b5ddd3ae36ea59d6b557c0f61457669f6d5371403603663a38c14a04b18c4706",
                "md5": "bff293891c10a56be834768707f23529",
                "sha256": "980af515243d41a562fc03dd21c2f81e10f7d4eb378c18ff266a197c38b15a6c"
            },
            "downloads": -1,
            "filename": "pandas-indexing-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bff293891c10a56be834768707f23529",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.8",
            "size": 69574,
            "upload_time": "2024-04-09T15:19:39",
            "upload_time_iso_8601": "2024-04-09T15:19:39.836836Z",
            "url": "https://files.pythonhosted.org/packages/b5/dd/d3ae36ea59d6b557c0f61457669f6d5371403603663a38c14a04b18c4706/pandas-indexing-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 15:19:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "coroa",
    "github_project": "pandas-indexing",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "pandas-indexing"
}
        
Elapsed time: 0.23224s