Skip to main content

Helpers to facilitate working with pandas indices in particular multiindices

Project description

CI Codecov Read the Docs PyPI Conda

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.6.3.tar.gz (48.7 kB view details)

Uploaded Source

Built Distribution

pandas_indexing-0.6.3-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file pandas_indexing-0.6.3.tar.gz.

File metadata

  • Download URL: pandas_indexing-0.6.3.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pandas_indexing-0.6.3.tar.gz
Algorithm Hash digest
SHA256 3cfcb19c67ef286f58a77e528fb5afad095173fd238b3d4f3363e26ee1bddcb7
MD5 79223e78b724ebc06ba535e5963b7906
BLAKE2b-256 e9a4ae47c134967d119051c357c054e98be14994cfb034bef21c65e5362dd146

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pandas_indexing-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a51d92359b6d65c4d90d35ce727f8f1ab045aa8c1bc204478ce17089c23ced0f
MD5 297081d1a70b95b1e36d6a3ef4cce4d9
BLAKE2b-256 678a517d31c6b7326bf814024b83ecc6396e65e71b68b37f2c4638795d637a15

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page