Skip to main content

altslice : Index different

The altslice package provides a number of Slicer classes which can be used to index and slice sequences using alternative indexing. For example:

from altslice import CategoricalSlicer

months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
sales = [100, 200, 250, 300, 333, 400]

slicer = CategoricalSlicer(months)

# sales total from January
sales[slicer['Jan']]

# sales from Febuary until May
sales[slicer['Jan':'May']]

Slicers

The following Slicers are provided in the library:

  • CategoricalSlicer : Index using discrete categories.

  • UniformSlicer : Index using evenly spaced numbers with a specific interval.

  • SeqeuenceSlicer : Index using a sorted sequence of numbers.

  • OneBasedSlicer : One-based indexing.

Install

altslice can be installed using pip:

pip install altslice

Testing

altslice uses pytest for testing. The test suite can be executed using py.test.

One-based indexing

If desired the list container can be adjusted to use one-based indexing:

from altslice import OneBasedSlicer

slicer = OneBasedSlicer()

class list(list):
    def __getitem__(self, x):
        return super(list, self).__getitem__(slicer[x])

This adjustment is not recommended.

Metadata

Release files for altslice 0.1.0

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

Source distribution (sdist)

Source distribution for altslice 0.1.0
File Size Uploaded Provenance Actions
altslice-0.1.0.tar.gz 6.5 kB Without provenance Details for altslice-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for altslice 0.1.0
File Interpreter ABI Platform Actions
altslice-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for altslice-0.1.0-py2.py3-none-any.whl

Total release size: 10.9 kB

Release files / altslice-0.1.0.tar.gz

Download URL altslice-0.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b351a489fa4811250f8ee53b2463359bbde1f9d71dc2973545dca65c6d9d2044
BLAKE2b-256 checksum
How to use checksums
b00fc3274a1526700306a3e94da7c3efdd3221050714d4a5c4d469dad4652e15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / altslice-0.1.0-py2.py3-none-any.whl

Download URL altslice-0.1.0-py2.py3-none-any.whl
Size 4.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5ffc64bd462c0bb40c5f586fd5a8d55360ab84f6a7eafc64701be858db20e6d4
BLAKE2b-256 checksum
How to use checksums
e719fc1257c65a066c1d2dc5eb972f197e44f20771729b392c2316ad58fb5b33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for altslice 0.1.0

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.0 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