ndindex
A Python library for manipulating indices of ndarrays.
Decision gist · record as of 2026-08-14
Yes, if you work with array indexing logic in libraries, frameworks, or tools that need to reason about indices without executing them. The library is well-maintained within its scope, has no dependencies, and carries no security vulnerabilities. However, the aging maintenance status (268 days since last release) means you should verify active support if you depend on frequent updates or encounter edge cases.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.9
- Medium install friction due to platform-specific wheels across multiple Python versions and architectures, but no runtime dependencies.
- Last release was 268 days ago; maintenance status is aging.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you may use, modify, and distribute ndindex freely in commercial and private projects with minimal restrictions.
last release 2025-11-19 (268 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,635,994 downloads/mo, #2,549 on PyPI
Alternatives
Verify before relying
from ndindex import Slice, Tuple
# Canonicalize a slice over a shape
result = Slice(-2, 10, 3).reduce(5)
print(result) # Slice(3, 4, 1)
# Compute resulting shape after indexing
shape = Tuple(0, slice(0, 10)).newshape((10, 20))
print(shape) # (10,)- Whether the library handles all edge cases in array indexing semantics beyond the documented scope
- Performance characteristics when working with complex multi-dimensional indices
What it is and what it does
ndindex is a library for working with array indices as first-class objects. Instead of treating slices, integers, ellipses, and other index types as separate, incompatible objects, ndindex wraps them in a uniform API so you can inspect, transform, and reason about them programmatically. It guarantees that all transformations match actual array indexing semantics—meaning if you reduce or manipulate an index through ndindex, the result will behave identically to real array behavior.
The library is useful when you need to reason about array shapes and indices without materializing arrays, optimize index expressions, or verify that an index operation would succeed before executing it. It handles the full range of indexing: simple slices, negative indices, steps, ellipses, boolean masks, integer arrays, and nested tuples. For operations where array shape is known, ndindex can reduce complex indices to simpler equivalent forms.
Use it for
- Canonicalize and simplify slice objects to their minimal equivalent form for a given array shape
- Compute the output shape of an array after indexing without materializing the array itself
- Check whether an index operation would produce an empty result before executing it
- Validate and transform user-provided indices in array-processing libraries or frameworks
- Implement index-aware optimizations in array computation engines
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with array indexing logic in libraries, frameworks, or tools that need to reason about indices without executing them.
The library is well-maintained within its scope, has no dependencies, and carries no security vulnerabilities. However, the aging maintenance status (268 days since last release) means you should verify active support if you depend on frequent updates or encounter edge cases.
Install
ndindex on PyPI
Before you install
Medium install friction due to platform-specific wheels across multiple Python versions and architectures, but no runtime dependencies. Last release was 268 days ago; maintenance status is aging.
Requires Python >= 3.9
License in practice
MIT license is permissive; you may use, modify, and distribute ndindex freely in commercial and private projects with minimal restrictions.
Quickstart
from ndindex import Slice, Tuple
# Canonicalize a slice over a shape
result = Slice(-2, 10, 3).reduce(5)
print(result) # Slice(3, 4, 1)
# Compute resulting shape after indexing
shape = Tuple(0, slice(0, 10)).newshape((10, 20))
print(shape) # (10,)
Verify before relying
- Whether the library handles all edge cases in array indexing semantics beyond the documented scope
- Performance characteristics when working with complex multi-dimensional indices
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Aging 268 days since the last release |
| First released | |
| Downloads | 3,635,994 / month, #2,549 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Operating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: ndindex-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl; ndindex-1.10.1-cp310-cp310-macosx_11_0_arm64.whl; ndindex-1.10.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ndindex-1.10.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; ndindex-1.10.1-cp310-cp310-musllinux_1_2_aarch64.whl; ndindex-1.10.1-cp310-cp310-musllinux_1_2_x86_64.whl; ndindex-1.10.1-cp310-cp310-win32.whl; ndindex-1.10.1-cp310-cp310-win_amd64.whl; ndindex-1.10.1-cp311-cp311-macosx_10_9_x86_64.whl; ndindex-1.10.1-cp311-cp311-macosx_11_0_arm64.whl; ndindex-1.10.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ndindex-1.10.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; ndindex-1.10.1-cp311-cp311-musllinux_1_2_aarch64.whl; ndindex-1.10.1-cp311-cp311-musllinux_1_2_x86_64.whl; ndindex-1.10.1-cp311-cp311-win32.whl; ndindex-1.10.1-cp311-cp311-win_amd64.whl; ndindex-1.10.1-cp312-cp312-macosx_10_13_x86_64.whl; ndindex-1.10.1-cp312-cp312-macosx_11_0_arm64.whl; ndindex-1.10.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ndindex-1.10.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “numpy array indexing manipulation”
- ndindexndindex provides a uniform API for representing and manipulating…
- fastremapRemap, renumber, and relabel NumPy arrays at C++ speed, plus perform…
- numpy-groupiesProvides optimized group-indexing operations on arrays, with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Mathematics packages
NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.
kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.
Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.
SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.
onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.
Install it if you have ONNX models to run in production or development.
See also arraykit · slicer · bitarray · bitarray-hardbyte · rcslice · numpy-groupies · awkward0 · numpydantic · einx · fixedint