dask-awkward icon indicating copy to clipboard operation
dask-awkward copied to clipboard

Add __array_function__ to dispatch NumPy funcs to dask-awkward

Open supercoder-dev opened this issue 1 year ago • 1 comments

Add NumPy function dispatching to dask-awkward

This PR adds an array_function method to the Array class, allowing NumPy functions to be automatically redirected to their dask-awkward counterparts. It covers 38 common functions, making it easier to use NumPy-style operations with dask-awkward arrays.

supercoder-dev avatar Jun 26 '24 10:06 supercoder-dev

I'd be a bit careful with this kind of dispatch. The numpy functions can have subtly different behaviors from their awkward counterparts. This mapping isn't very well defined for the arbitrary numpy functions (but is for ufuncs).

It would almost be better to suggest converting to dask.array and error out since there the expected behavior is much more clear.

lgray avatar Jun 26 '24 14:06 lgray