Skip to main content

HeaderIndexer

A system to bind aliases to indexes of headers in a matrix.

Given a dict of header aliases paired to the actual header value (or an iterable of possible values) creates a dict with entries {'alias': column_index}

Includes interactive prompts to manually select headers when unable to find, and optional duplicate checks for aliases sharing indexes

Installation

pip install headerindexer

Using HeaderIndexer

from headerindexer import HI
indexer = HI()
headers = ["Date", "OS", "TrackingID", "DNSHostname", b"DNSHostname", 77]
aliases = {
   b'hostname':     ["DNSHostname", b'DNSHostname'],
   "track":        ("1TrackingID1", 'TrackingID'),
   "OS":           "OperatingSystem",
   7:              77
}
aliases_to_indexes = indexer.run(headers, aliases)

Assume we've extracted a row of headers from a spreadsheet. Create a dictionary like aliases, and pass them both to indexer (HI.run())

# aliases_to_indexes, generated above
{b'hostname': 3, 'track': 2, 'OS': 1, 7: 5}

The returned dictionary can be used to reliably call on the appropriate column by given aliases

Headers not found/Duplicates headers

By default, when an alias' header cannot be located headerindexer will prompt the user to manually select from a list of all headers, one by one

Additionally HI.allow_duplicates can be set to False in or after init, enabling a similar mode of prompting whenever two or more aliases share the same index value

Metadata

Release files for headerindexer 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for headerindexer 0.1.5
File Size Uploaded Provenance Actions
headerindexer-0.1.5.tar.gz 11.1 kB Without provenance Details for headerindexer-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for headerindexer 0.1.5
File Interpreter ABI Platform Actions
headerindexer-0.1.5-py3-none-any.whl Python 3 none any Details for headerindexer-0.1.5-py3-none-any.whl

Total release size: 30.9 kB

Release files / headerindexer-0.1.5.tar.gz

Download URL headerindexer-0.1.5.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
93ea5509df82deae1a6acb49f70b94d7703e70cffb88b3b4df27450ce0a295ba
BLAKE2b-256 checksum
How to use checksums
7034ddb0a60f1c9c69acf95ac04dd1b14f3f4f2a4db10c8842688701d9d033df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release files / headerindexer-0.1.5-py3-none-any.whl

Download URL headerindexer-0.1.5-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaeac2ff21cda352ed21d60b0a51f3d5716672ebf262a92a8be7fdbbacd3ddbe
BLAKE2b-256 checksum
How to use checksums
793619455afff86fe2f226405444041a05110403608fbd60faf8a15177cc1568
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Security for headerindexer 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page