Compatibility with numpy functions

Compatibility with numpy functions

The following table describes the compatibilities between numpy and dask.array functions. Please be aware that some inconsistencies with the two versions may exist.

This table has been compiled manually and may not reflect the current Dask state. Update contributions are welcome.

  • A blank entry indicates that the function is not implemented in Dask.

  • Direct implementation are direct calls to numpy functions.

  • Element-wise implementations are derived from numpy but applied element-wise: the argument should be a dask array.

  • Dask equivalent are Dask implementations, which may lack or add parameters with respect to the numpy function.

A more in-depth comparison in the framework of the Array API is available via the Array API Comparison repository.

NumPy

Dask

Implementation

numpy.absolute

dask.array.absolute or dask.array.abs

direct (ufunc)

numpy.add

dask.array.add

direct (ufunc)

numpy.all

dask.array.all 21

dask equivalent

numpy.allclose

dask.array.allclose

dask equivalent

numpy.amax

dask.array.max 21 22

dask equivalent

numpy.amin

dask.array.min 21 22

dask equivalent

numpy.angle

dask.array.angle 23

dask equivalent

numpy.any

dask.array.any 21

dask equivalent

numpy.append

dask.array.append

dask equivalent

numpy.apply_along_axis

dask.array.apply_along_axis

dask equivalent

numpy.apply_over_axes

dask.array.apply_over_axes

dask equivalent

numpy.arange

dask.array.arange

dask equivalent

numpy.arccos

dask.array.arccos

direct (ufunc)

numpy.arccosh

dask.array.arccosh

direct (ufunc)

numpy.arcsin

dask.array.arcsin

direct (ufunc)

numpy.arcsinh

dask.array.arcsinh

direct (ufunc)

numpy.arctan

dask.array.arctan

direct (ufunc)

numpy.arctan2

dask.array.arctan2

direct (ufunc)

numpy.arctanh

dask.array.arctanh

direct (ufunc)

numpy.argmax

dask.array.argmax

dask equivalent

numpy.argmin

dask.array.argmin

dask equivalent

numpy.argpartition

-

numpy.argsort

dask.array.argtopk 25

numpy.argwhere

dask.array.argwhere

dask equivalent

numpy.around

dask.array.around 23 26 or dask.array.round

dask equivalent

numpy.array

dask.array.array

dask equivalent

numpy.array2string

-

numpy.array_equal

-

numpy.array_equiv

-

numpy.array_repr

-

numpy.array_split

-

numpy.array_str

-

numpy.asanyarray

dask.array.asanyarray

dask equivalent

numpy.asarray

dask.array.asarray

dask equivalent

numpy.asarray_chkfinite

-

numpy.ascontiguousarray

-

numpy.asfarray

-

numpy.asfortranarray

-

numpy.asmatrix

- 27

numpy.atleast_1d

dask.array.atleast_1d

dask equivalent

numpy.atleast_2d

dask.array.atleast_2d

dask equivalent

numpy.atleast_3d

dask.array.atleast_3d

dask equivalent

numpy.average

dask.array.average

dask equivalent

numpy.bartlett

-

numpy.bincount

dask.array.bincount

dask equivalent

numpy.bitwise_and

dask.array.bitwise_and

direct (ufunc)

numpy.bitwise_or

dask.array.bitwise_or

direct (ufunc)

numpy.bitwise_xor

dask.array.bitwise_xor

direct (ufunc)

numpy.blackman

-

numpy.block

dask.array.block

dask equivalent

numpy.bmat

- 27

numpy.broadcast

-

numpy.broadcast_arrays

dask.array.broadcast_arrays

dask equivalent

numpy.broadcast_shapes

-

numpy.broadcast_to

dask.array.broadcast_to

dask equivalent

numpy.byte_bounds

-

numpy.c_

-

numpy.can_cast

-

numpy.cbrt

dask.array.cbrt

direct (ufunc)

numpy.ceil

dask.array.ceil

direct (ufunc)

numpy.choose

dask.array.choose 28

dask equivalent

numpy.clip

dask.array.clip 23 26

direct (non-ufunc elementwise)

numpy.column_stack

-

numpy.common_type

-

numpy.compress

dask.array.compress 26

dask equivalent

numpy.concatenate

dask.array.concatenate

dask equivalent

numpy.conj

dask.array.conj

direct (ufunc)

numpy.conjugate

dask.array.conj

direct (ufunc)

numpy.convolve

-

numpy.copy

-

numpy.copysign

dask.array.copysign

direct (ufunc)

numpy.copyto

-

numpy.corrcoef

dask.array.corrcoef

dask equivalent

numpy.correlate

-

numpy.cos

dask.array.cos

direct (ufunc)

numpy.cosh

dask.array.cosh

direct (ufunc)

numpy.count_nonzero

dask.array.count_nonzero 29

dask equivalent

numpy.cov

dask.array.cov 30

dask equivalent

numpy.cross

-

numpy.cumprod

dask.array.cumprod 23 38

dask equivalent

numpy.cumsum

dask.array.cumsum 23 38

dask equivalent

numpy.datetime_as_string

-

numpy.deg2rad

dask.array.deg2rad

direct (ufunc)

numpy.degrees

dask.array.degrees

direct (ufunc)

numpy.delete

dask.array.delete

dask equivalent

numpy.diag

dask.array.diag

dask equivalent

numpy.diag_indices

-

numpy.diag_indices_from

-

numpy.diagflat

-

numpy.diagonal

dask.array.diagonal

dask equivalent

numpy.diff

dask.array.diff

dask equivalent

numpy.digitize

dask.array.digitize 23

dask equivalent

numpy.divide

dask.array.divide

direct (ufunc)

numpy.divmod

dask.array.divmod

dask equivalent

numpy.dot

dask.array.dot 26

dask equivalent

numpy.dsplit

-

numpy.dstack

dask.array.dstack

dask equivalent

numpy.ediff1d

dask.array.ediff1d

dask equivalent

numpy.einsum

dask.array.einsum 26

dask equivalent

numpy.einsum_path

-

numpy.empty

dask.array.empty

dask equivalent

numpy.empty_like

dask.array.empty_like

dask equivalent

numpy.equal

dask.array.equal

direct (ufunc)

numpy.exp

dask.array.exp

direct (ufunc)

numpy.exp2

dask.array.exp2

direct (ufunc)

numpy.expand_dims

dask.array.expand_dims

dask equivalent

numpy.expm1

dask.array.expm1

direct (ufunc)

numpy.extract

dask.array.extract

dask equivalent

numpy.eye

dask.array.eye

dask equivalent

numpy.fabs

dask.array.fabs

direct (ufunc)

numpy.fill_diagonal

-

numpy.fix

dask.array.fix

direct (non-ufunc elementwise)

numpy.flatnonzero

dask.array.flatnonzero

dask equivalent

numpy.flip

dask.array.flip

dask equivalent

numpy.fliplr

dask.array.fliplr

dask equivalent

numpy.flipud

dask.array.flipud

dask equivalent

numpy.float_power

dask.array.float_power

direct (ufunc)

numpy.floor

dask.array.floor

direct (ufunc)

numpy.floor_divide

dask.array.floor_divide

direct (ufunc)

numpy.fmax

dask.array.fmax

direct (ufunc)

numpy.fmin

dask.array.fmin

direct (ufunc)

numpy.fmod

dask.array.fmod

direct (ufunc)

numpy.frexp

dask.array.frexp

dask equivalent

numpy.from_dlpack

-

numpy.frombuffer

-

numpy.fromfile

-

numpy.fromfunction

dask.array.fromfunction 31

dask equivalent

numpy.fromiter

-

numpy.frompyfunc

dask.array.frompyfunc 32

dask equivalent

numpy.fromregex

-

numpy.fromstring

-

numpy.full

dask.array.full

dask equivalent

numpy.full_like

dask.array.full_like

dask equivalent

numpy.gcd

-

numpy.genfromtxt

-

numpy.geomspace

-

numpy.gradient

dask.array.gradient 33

dask equivalent

numpy.greater

dask.array.greater

direct (ufunc)

numpy.greater_equal

dask.array.greater_equal

direct (ufunc)

numpy.hamming

-

numpy.hanning

-

numpy.heaviside

-

numpy.histogram

dask.array.histogram

dask equivalent

numpy.histogram2d

dask.array.histogram2d

dask equivalent

numpy.histogram_bin_edges

-

numpy.histogramdd

dask.array.histogramdd 34

dask equivalent

numpy.hsplit

-

numpy.hstack

dask.array.hstack

dask equivalent

numpy.hypot

dask.array.hypot

direct (ufunc)

numpy.i0

dask.array.i0

direct (non-ufunc elementwise)

numpy.identity

-

numpy.imag

dask.array.imag

direct (non-ufunc elementwise)

numpy.in1d

-

numpy.indices

dask.array.indices

dask equivalent

numpy.inner

-

numpy.insert

dask.array.insert 35

dask equivalent

numpy.interp

-

numpy.intersect1d

-

numpy.invert

dask.array.invert or dask.array.bitwise_not

direct (ufunc)

numpy.is_busday

-

numpy.isclose

dask.array.isclose

dask equivalent

numpy.iscomplex

dask.array.iscomplex

direct (non-ufunc elementwise)

numpy.iscomplexobj

-

numpy.isfinite

dask.array.isfinite

direct (ufunc)

numpy.isfortran

-

numpy.isin

dask.array.isin

dask equivalent

numpy.isinf

dask.array.isinf

direct (ufunc)

numpy.isnan

dask.array.isnan

direct (ufunc)

numpy.isnat

-

numpy.isneginf

dask.array.isneginf

direct (ufunc)

numpy.isposinf

dask.array.isposinf

direct (ufunc)

numpy.isreal

dask.array.isreal

direct (non-ufunc elementwise)

numpy.ix_

-

numpy.kaiser

-

numpy.kron

-

numpy.lcm

-

numpy.ldexp

dask.array.ldexp

direct (ufunc)

numpy.left_shift

dask.array.left_shift

direct (ufunc)

numpy.less

dask.array.less

direct (ufunc)

numpy.less_equal

dask.array.less_equal

direct (ufunc)

numpy.lexsort

-

numpy.linspace

dask.array.linspace

dask equivalent

numpy.load

-

numpy.loadtxt

-

numpy.log

dask.array.log

direct (ufunc)

numpy.log10

dask.array.log10

direct (ufunc)

numpy.log1p

dask.array.log1p

direct (ufunc)

numpy.log2

dask.array.log2

direct (ufunc)

numpy.logaddexp

dask.array.logaddexp

direct (ufunc)

numpy.logaddexp2

dask.array.logaddexp2

direct (ufunc)

numpy.logical_and

dask.array.logical_and

direct (ufunc)

numpy.logical_not

dask.array.logical_not

direct (ufunc)

numpy.logical_or

dask.array.logical_or

direct (ufunc)

numpy.logical_xor

dask.array.logical_xor

direct (ufunc)

numpy.logspace

-

numpy.mask_indices

-

numpy.mat

- 27

numpy.matmul

dask.array.matmul

dask equivalent

numpy.matrix

- 27

numpy.maximum

dask.array.maximum

direct (ufunc)

numpy.may_share_memory

-

numpy.mean

dask.array.mean 21

dask equivalent

numpy.median

dask.array.median 36

dask equivalent

numpy.memmap

-

numpy.meshgrid

dask.array.meshgrid 37

dask equivalent

numpy.mgrid

-

numpy.minimum

dask.array.minimum

direct (ufunc)

numpy.mintypecode

-

numpy.mod

dask.array.mod

direct (ufunc)

numpy.modf

dask.array.modf

dask equivalent

numpy.moveaxis

dask.array.moveaxis

dask equivalent

numpy.multiply

dask.array.multiply

direct (ufunc)

numpy.nan_to_num

dask.array.nan_to_num

direct (non-ufunc elementwise)

numpy.nanargmax

dask.array.nanargmax

dask equivalent

numpy.nanargmin

dask.array.nanargmin

dask equivalent

numpy.nancumprod

dask.array.nancumprod 23 38

dask equivalent

numpy.nancumsum

dask.array.nancumsum 23 38

dask equivalent

numpy.nanmax

dask.array.nanmax 21 22

dask equivalent

numpy.nanmean

dask.array.nanmean 21

dask equivalent

numpy.nanmedian

dask.array.nanmedian 36

dask equivalent

numpy.nanmin

dask.array.nanmin 21 22

dask equivalent

numpy.nanpercentile

-

numpy.nanprod

dask.array.nanprod 21 22

dask equivalent

numpy.nanquantile

-

numpy.nanstd

dask.array.nanstd 21

dask equivalent

numpy.nansum

dask.array.nansum 21 22

dask equivalent

numpy.nanvar

dask.array.nanvar 21

dask equivalent

numpy.ndenumerate

-

numpy.ndindex

-

numpy.nditer

-

numpy.negative

dask.array.negative

direct (ufunc)

numpy.nested_iters

-

numpy.nextafter

dask.array.nextafter

direct (ufunc)

numpy.nonzero

dask.array.nonzero

dask equivalent

numpy.not_equal

dask.array.not_equal

direct (ufunc)

numpy.ogrid

-

numpy.ones

dask.array.ones

dask equivalent

numpy.ones_like

dask.array.ones_like

dask equivalent

numpy.outer

dask.array.outer

dask equivalent

numpy.packbits

-

numpy.pad

dask.array.pad

dask equivalent

numpy.partition

-

numpy.percentile

dask.array.percentile

dask equivalent

numpy.piecewise

dask.array.piecewise

dask equivalent

numpy.place

-

numpy.poly

-

numpy.poly1d

-

numpy.polyadd

-

numpy.polyder

-

numpy.polydiv

-

numpy.polyfit

-

numpy.polyint

-

numpy.polymul

-

numpy.polysub

-

numpy.polyval

-

numpy.positive

dask.array.positive

direct (ufunc)

numpy.power

dask.array.power

direct (ufunc)

numpy.prod

dask.array.prod

dask equivalent

numpy.ptp

dask.array.ptp

dask equivalent

numpy.put

-

numpy.put_along_axis

-

numpy.putmask

-

numpy.quantile

-

numpy.r_

-

numpy.rad2deg

dask.array.rad2deg

direct (ufunc)

numpy.radians

dask.array.radians

direct (ufunc)

numpy.ravel

dask.array.ravel 23 24

dask equivalent

numpy.ravel_multi_index

dask.array.ravel_multi_index

dask equivalent

numpy.real

dask.array.real

direct (non-ufunc elementwise)

numpy.real_if_close

-

numpy.reciprocal

dask.array.reciprocal

direct (ufunc)

numpy.remainder

dask.array.remainder

direct (ufunc)

numpy.repeat

dask.array.repeat

dask equivalent

numpy.require

-

numpy.reshape

dask.array.reshape

dask equivalent

numpy.resize

-

numpy.result_type

dask.array.result_type

dask equivalent

numpy.right_shift

dask.array.right_shift

direct (ufunc)

numpy.rint

dask.array.rint

direct (ufunc)

numpy.roll

dask.array.roll

dask equivalent

numpy.rollaxis

dask.array.rollaxis

dask equivalent

numpy.roots

-

numpy.rot90

dask.array.rot90

dask equivalent

numpy.row_stack

-

numpy.save

-

numpy.savetxt

-

numpy.savez

-

numpy.savez_compressed

-

numpy.searchsorted

dask.array.searchsorted

dask equivalent

numpy.select

dask.array.select

dask equivalent

numpy.setdiff1d

-

numpy.setxor1d

-

numpy.shape

dask.array.shape 23

dask equivalent

numpy.shares_memory

-

numpy.sign

dask.array.sign

direct (ufunc)

numpy.signbit

dask.array.signbit

direct (ufunc)

numpy.sin

dask.array.sin

direct (ufunc)

numpy.sinc

dask.array.sinc

direct (non-ufunc elementwise)

numpy.sinh

dask.array.sinh

direct (ufunc)

numpy.sort

dask.array.topk 25

numpy.sort_complex

-

numpy.source

-

numpy.spacing

dask.array.spacing

direct (ufunc)

numpy.split

-

numpy.sqrt

dask.array.sqrt

direct (ufunc)

numpy.square

dask.array.square

direct (ufunc)

numpy.squeeze

dask.array.squeeze

dask equivalent

numpy.stack

dask.array.stack

dask equivalent

numpy.std

dask.array.std 21

dask equivalent

numpy.subtract

dask.array.subtract

direct (ufunc)

numpy.sum

dask.array.sum 21 22

dask equivalent

numpy.swapaxes

dask.array.swapaxes

dask equivalent

numpy.take

dask.array.take 28

dask equivalent

numpy.take_along_axis

-

numpy.tan

dask.array.tan

direct (ufunc)

numpy.tanh

dask.array.tanh

direct (ufunc)

numpy.tensordot

dask.array.tensordot

dask equivalent

numpy.tile

dask.array.tile

dask equivalent

numpy.trace

dask.array.trace 26

dask equivalent

numpy.transpose

dask.array.transpose

dask equivalent

numpy.trapz

-

numpy.tri

dask.array.tri

dask equivalent

numpy.tril

dask.array.tril

dask equivalent

numpy.tril_indices

dask.array.tril_indices

dask equivalent

numpy.tril_indices_from

dask.array.tril_indices_from

dask equivalent

numpy.trim_zeros

-

numpy.triu

dask.array.triu

dask equivalent

numpy.triu_indices

dask.array.triu_indices

dask equivalent

numpy.triu_indices_from

dask.array.triu_indices_from

dask equivalent

numpy.true_divide

dask.array.true_divide

direct (ufunc)

numpy.trunc

dask.array.trunc

direct (ufunc)

numpy.union1d

dask.array.union1d

dask equivalent

numpy.unique

dask.array.unique 39

dask equivalent

numpy.unpackbits

-

numpy.unravel_index

dask.array.unravel_index

dask equivalent

numpy.unwrap

-

numpy.vander

-

numpy.var

dask.array.var 21

dask equivalent

numpy.vdot

dask.array.vdot

dask equivalent

numpy.vsplit

-

numpy.vstack

dask.array.vstack 40

dask equivalent

numpy.where

dask.array.where

dask equivalent

numpy.zeros

dask.array.zeros

dask equivalent

numpy.zeros_like

dask.array.zeros_like

dask equivalent

Footnotes

21(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)

where parameter not supported.

22(1,2,3,4,5,6,7)

initial parameter not supported.

23(1,2,3,4,5,6,7,8,9,10)

Input must be a dask array.

24

order parameter not supported.

25(1,2)

Sort operations are notoriously difficult to do in parallel. Parallel-friendly alternatives sort the k largest elements.

26(1,2,3,4,5,6)

out parameter not supported.

27(1,2,3,4)

Use of numpy.matrix is discouraged in NumPy and thus there is no need to add it.

28(1,2)

mode parameter not supported.

29

keepdims parameter not supported.

30

fweights, aweights, dtype parameters not supported.

31

like parameter not supported. Callable functions not supported.

32

Not implemented with more than one output.

33

edge_order parameter not supported.

34

Chunking of the input data (sample) is only allowed along the 0th (row) axis.

35

Only implemented for monotonic obj arguments.

36(1,2)

overwrite_input parameter not supported.

37

copy parameter not supported.

38(1,2,3,4)

Dask implementation introduces an additional parameter method.

39

axis parameter not supported.

40

casting parameter not supported.