dask_awkward.utils.ConcretizationTypeError#
- exception dask_awkward.utils.ConcretizationTypeError(msg)[source]#
This error occurs when a
dask_awkward.Array
is used in a context that requires a concrete value.There are several reasons why this error might occur:
Examples
When a
dask_awkward.Array
is used in a conditional statement:
>>> import dask_awkward as dak >>> import awkward as ak >>> dask_arr = dak.from_awkward(ak.Array([1]), npartitions=1) >>> if dask_arr > 2: >>> dask_arr += 1 Traceback (most recent call last): ... dask_awkward.utils.ConcretizationTypeError: A dask_awkward.Array is encountered in a computation where a concrete value is expected. If you intend to convert the dask_awkward.Array to a concrete value, use the `.compute()` method. The __bool__() method was called on dask.awkward<greater, npartitions=1>.
When a
dask_awkward.Array
is cast to a Python type:
>>> import dask_awkward as dak >>> import awkward as ak >>> dask_arr = dak.from_awkward(ak.Array([1]), npartitions=1) >>> int(dask_arr) Traceback (most recent call last): ... dask_awkward.utils.ConcretizationTypeError: A dask_awkward.Array is encountered in a computation where a concrete value is expected. If you intend to convert the dask_awkward.Array to a concrete value, use the `.compute()` method. The __int__() method was called on dask.awkward<from-awkward, npartitions=1>.
These errors can be resolved by explicitely converting the tracer to a concrete value:
>>> import dask_awkward as dak >>> dask_arr = dak.from_awkward(ak.Array([1]), npartitions=1) >>> bool(dask_arr.compute()) True
- Parameters:
msg (str)