NDField¶
This class is used to represent fields of a structured NDArray.
For instance, you can create an array with two fields:
s = blosc2.empty(shape, dtype=[("a", np.float32), ("b", np.float64)])
a = blosc2.NDField(s, "a")
b = blosc2.NDField(s, "b")
- class blosc2.NDField(ndarr: NDArray, field: str)[source]¶
-
- Special Methods:
__init__
(ndarr, field)Create a new NDField.
__iter__
()Iterate over the elements in the field.
__len__
()Returns the length of the first dimension of the field.
__getitem__
(key)Get a slice of
self
.__setitem__
(key, value)Set a slice of
self
to a value.Constructor¶
Utility Methods¶
- __getitem__(key: int | slice | Sequence[slice]) np.ndarray [source]¶
Get a slice of
self
.- Parameters:
key¶ (int or slice or Sequence[slice]) – The slice to be retrieved.
- Returns:
out – A NumPy array with the data slice.
- Return type:
NumPy.ndarray