slicer
A small package for big slicing.
What it is and what it does
Slicer wraps tensor-like objects and provides a single, uniform slicing syntax that works across numpy arrays, pandas DataFrames, scipy sparse matrices, PyTorch tensors, and Python built-ins (lists, tuples, dicts). Instead of learning each library's indexing conventions, you wrap objects with `S()` and slice them all the same way via `__getitem__`. The package handles non-integer indexes (useful for selecting DataFrame columns by name), nested slicing in one call, and simultaneous slicing of multiple objects at once—returning results as named attributes or via `.o` for anonymous access.
With zero runtime dependencies and support for Python 3.6+, slicer is lightweight and portable. It's designed for workflows where you need to slice multiple heterogeneous data structures in parallel. The package includes an Alias mechanism to use semantic keys as slicing indices, bridging the gap between positional and label-based indexing.
Use it for:
- Slice multiple data structures in parallel with a single index operation
- Select DataFrame columns by name using the same syntax as positional array slicing
- Extract nested subsets from mixed-type data structures in one call
- Build data pipelines with consistent indexing across multiple data types
- Use semantic aliases as slicing keys without manual index lookup
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a uniform slicing interface for tensor-like objects (numpy, pandas, scipy, PyTorch, lists, tuples, dicts) via `__getitem__`, enabling non-integer indexing and nested slicing in a single call.
Yes, if you regularly slice multiple heterogeneous data structures and want a unified interface. The zero-dependency design and permissive license make it safe to add. The alpha status and lack of updates since 2024-03-09 are minor concerns for a stable utility, but verify it handles your specific data types before production use.
Install
slicer on PyPI
pip
pip install sliceruv
uv add slicerpoetry
poetry add slicerInstalling slicer
Before you install
No runtime dependencies and a pure-Python wheel make installation frictionless. The package is in alpha status and hasn't been updated since 2024-03-09, though the repository remains active.
License in practice
MIT license (permissive) allows use in most projects without restriction, including commercial and proprietary work.
Quickstart
from slicer import Slicer as S
li = [[1, 2, 3], [4, 5, 6]]
S(li)[:, 0:2].o
# [[1, 2], [4, 5]]
# Named slicing across multiple objects
sliced = S(first=df, second=ar)[0, :]
sliced.first
Verify before relying
- Whether the alpha status reflects incomplete features or conservative versioning
- Performance characteristics when slicing very large objects or deeply nested structures
- Compatibility with versions of numpy, pandas, and PyTorch beyond what classifiers declare
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 888 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,860,793/month — #1,214 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: slicer-0.0.8-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
ndindexndindex provides a uniform API for representing…
permissive · top 5,000 on PyPI
rcsliceSlices lists using a row-column notation with…
permissive · top 15,000 on PyPI
sahiSAHI performs sliced inference on large images…
permissive · top 15,000 on PyPI
acvl-utilsProvides utility functions for dynamic…
permissive · top 15,000 on PyPI
flatdictFlattens nested dictionaries into single-level…
permissive · top 5,000 on PyPI
sliceratorSlicerator wraps a class's `__getitem__` method…
permissive · top 15,000 on PyPI
magicattrProvides nested attribute access and…
permissive · top 5,000 on PyPI
recursive-diffRecursively compares two Python data structures…
permissive · top 15,000 on PyPI
mulpyplexerMulpyplexer applies method calls and attribute…
permissive · top 15,000 on PyPI
tensordictTensorDict is a batched, nested dictionary…
permissive · top 5,000 on PyPI