Skip to main content

Helpers to facilitate working with pandas indices in particular multiindices

Project description

CI Codecov Read the Docs 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:

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

or with shell like glob-patterns:

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

You can overwrite index levels:

assignlevel(df, selected=1)

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

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.

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

pandas-indexing-0.1.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandas_indexing-0.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pandas-indexing-0.1.1.tar.gz.

File metadata

  • Download URL: pandas-indexing-0.1.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for pandas-indexing-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d1a0b0e40b0d349d516c417b0f1b32655fe8796793bfb5ea6801027eb83f62ab
MD5 1fb4632b72d38d46e40700b60c6320f7
BLAKE2b-256 4cfeb6b4511d769d3210f113ce1276d519d9fe9a373a7ce468b65ca4940f990e

See more details on using hashes here.

File details

Details for the file pandas_indexing-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pandas_indexing-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8e14f680d598a656b3cac13bad56f391c8d2b791f16d9dd9a08feabc78bf8d2
MD5 ef80102417a651a59f5684b8974d6f19
BLAKE2b-256 058e378380e76327ff0113e2b948d902ec59611bf88a6e5e105ae28d10e062dd

See more details on using hashes here.

Supported by

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