Dask¶
Interface for Dask arrays
- pydantic model DaskJsonDict[source]¶
Round-trip json serialized form of a dask array
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Fields:
- class DaskInterface(shape: Tuple[int, ...] | Any = typing.Any, dtype: str | type | Any | generic = typing.Any)[source]¶
Interface for Dask
Array- json_model¶
alias of
DaskJsonDict
- get_object_dtype(array: NDArrayType) str | type | Any | generic[source]¶
Dask arrays require a compute() call to retrieve a single value
- classmethod to_json(array: Array, info: SerializationInfo | None = None) List | DaskJsonDict[source]¶
Convert an array to a JSON serializable array by first converting to a numpy array and then to a list.
Note
This is likely a very memory intensive operation if you are using dask for large arrays. This can’t be avoided, since the creation of the json string happens in-memory with Pydantic, so you are likely looking for a different method of serialization here using the python object itself rather than its JSON representation.