Closed alexander-held closed 1 month ago
https://github.com/dask-contrib/dask-awkward/pull/516 I think fixed this
Yes, version 2024.9.0 from PyPI has:
>>> import numpy as np
>>> import dask_awkward as dak
>>> import awkward as ak
>>>
>>> data = ak.Array(np.arange(10))
>>> a = dak.from_awkward(data, npartitions=1)
>>>
>>> print(f"sum: {(ak.sum(a)).compute()}")
sum: 45
>>> print(f"1/sum: {(1/ak.sum(a)).compute()}")
1/sum: 0.022222222222222223
>>> print(f"0.5/sum: {(0.5/ak.sum(a)).compute()}")
0.5/sum: 0.011111111111111112
It's fixed.
In the following example, dividing a scalar by an expression that reduces down to a scalar yields unexpected results:
output:
A way to make this work correctly instead is exponentiation:
print(f"sum**(-1.0): {(ak.sum(a)**(-1.0)).compute()}")
.When instead using
dask.array
viathe results are as expected:
I'm using
dask_awkward
version2024.6.0
.