numpydantic¶
Top-level API contents
- class NDArray(*_: Any, **__: Any)¶
Constrained array type allowing npytyping syntax for dtype and shape validation and serialization.
Integrates with pydantic such that - JSON schema for list of list encoding - Serialized as LoL, with automatic compression for large arrays - Automatic coercion from lists on instantiation
Also supports validation on
NDArrayProxy
types for lazy loading.References
- class Shape(*_: Any, **__: Any)¶
A container for shape expressions that describe the shape of an multi dimensional array.
Simple example:
>>> Shape['2, 2'] Shape['2, 2']
A Shape can be compared to a typing.Literal. You can use Literals in NDArray as well.
>>> from typing import Literal
>>> Shape['2, 2'] == Literal['2, 2'] True