Repository navigation
Open
Labels
Description
Below is a rough list of functions in NumPy that may be useful in Dask Array. This has been curated based on what may be manageable in Dask. Sorting operations have been dropped for instance.
- abs
- absolute
- add
- all
- allclose
- amax
- amin
- angle
- any
- append
- apply_along_axis
- apply_over_axes
- arange
- arccos
- arccosh
- arcsin
- arcsinh
- arctan
- arctan2
- arctanh
- argmax
- argmin
- argwhere
- around
- array_equal
- array_equiv
- array_split
- asanyarray
- asarray
- asarray_chkfinite
- asscalar
- atleast_1d
- atleast_2d
- atleast_3d
- average
- bartlett
- bincount
- bitwise_and
- bitwise_not
- bitwise_or
- bitwise_xor
- blackman
- block
- bmat
- broadcast
- broadcast_arrays
- broadcast_to
- c_
- can_cast
- cast
- cbrt
- ceil
- choose
- clip
- column_stack
- compress
- concatenate
- conj
- conjugate
- convolve
- copy
- copysign
- corrcoef
- correlate
- cos
- cosh
- count_nonzero
- cov
- cross
- cumprod
- cumsum
- deg2rad
- degrees
- delete
- diag
- diag_indices
- diag_indices_from
- diagflat
- diagonal
- diff
- digitize
- divide
- division
- divmod
- dot
- dsplit
- dstack
- ediff1d
- einsum
- empty
- empty_like
- equal
- euler_gamma
- exp
- exp2
- expand_dims
- expm1
- extract
- eye
- fabs
- fill_diagonal
- fix
- flatnonzero
- flip
- fliplr
- flipud
- float_power
- floor
- floor_divide
- fmax
- fmin
- fmod
- frexp
- fromfunction
- frompyfunc
- full
- full_like
- fv
- geomspace
- gradient
- greater
- greater_equal
- hamming
- hanning
- heaviside
- histogram
- histogram2d
- histogramdd
- hsplit
- hstack
- hypot
- i0
- identity
- imag
- in1d
- index_exp
- indices
- inexact
- inner
- insert
- interp
- intersect1d
- invert
- ipmt
- irr
- isclose
- iscomplex
- iscomplexobj
- isfinite
- isin
- isinf
- isnan
- isnat
- isneginf
- isposinf
- isreal
- isrealobj
- isscalar
- ix_
- kaiser
- kron
- ldexp
- left_shift
- less
- less_equal
- linspace
- log
- log10
- log1p
- log2
- logaddexp
- logaddexp2
- logical_and
- logical_not
- logical_or
- logical_xor
- logspace
- mask_indices
- matmul
- max
- maximum
- mean
- meshgrid
- mgrid
- min
- minimum
- mirr
- mod
- modf
- moveaxis
- multiply
- nan_to_num
- nanargmax
- nanargmin
- nancumprod
- nancumsum
- nanmax
- nanmean
- nanmin
- nanprod
- nanstd
- nansum
- nanvar
- ndim
- negative
- nextafter
- nonzero
- not_equal
- nper
- npv
- ogrid
- ones
- ones_like
- outer
- packbits
- pad
- piecewise
- place
- pmt
- poly
- poly1d
- polyadd
- polyder
- polydiv
- polyfit
- polyint
- polymul
- polynomial
- polysub
- polyval
- positive
- power
- ppmt
- prod
- product
- ptp
- put
- putmask
- pv
- r_
- rad2deg
- radians
- rate
- ravel
- ravel_multi_index
- real
- real_if_close
- reciprocal
- remainder
- repeat
- require
- reshape
- resize
- result_type
- right_shift
- roll
- rollaxis
- roots
- rot90
- round
- row_stack
- select
- setdiff1d
- setxor1d
- shape
- sign
- signbit
- sin
- sinc
- sinh
- size
- spacing
- split
- sqrt
- square
- squeeze
- stack
- std
- subtract
- sum
- swapaxes
- take
- tan
- tanh
- tensordot
- tile
- trace
- transpose
- trapz
- tri
- tril
- tril_indices
- tril_indices_from
- trim_zeros
- triu
- triu_indices
- triu_indices_from
- true_divide
- trunc
- union1d
- unique
- unpackbits
- unravel_index
- unwrap
- vander
- var
- vdot
- vectorize
- vsplit
- vstack
- where
- zeros
- zeros_like
Activity
mrocklin commentedon Dec 1, 2017
Some quick first impressions:
__array_ufunc__. I guess there is still value to implementing these explicitly for older versions of NumPy.jakirkham commentedon Dec 5, 2017
Agreed.
True. More generally we might want to survey what versions of NumPy are used with Dask. Not sure if this data is reported by
condasomehow.Agreed. Will give it some thought during the migration to the docs.
As more follow-up to the last point, are you thinking to group these as well? Should add am planning to add things like
numpy.fft/da.fftandnumpy.linalg/da.linalg. How do you imagine these fit in with the grid layout?mrocklin commentedon Dec 5, 2017
jakirkham commentedon Dec 5, 2017
Ok. No worries. I'll try something when putting them in the docs and we can discuss in that PR in more detail.
rabernat commentedon Jun 26, 2018
I just encountered a need for a blocked
histogram2d: https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.htmlI am voicing my support for adding this function to dask.
rabernat commentedon Sep 18, 2018
@dhruvbalwada: implementing histogram2d and histogramdd within dask would be an excellent way to proceed on the project we discussed regarding evaluating statistics of our high-resolution simulations. This would allow you to trivially compute, for example, the 2D histogram of vorticity and divergence for a very large dataset.
Alternatively, we could try to use datashader for this.
mrocklin commentedon Sep 18, 2018
horta commentedon Jan 25, 2019
Isn't
tracesimplyda.diag(K).sum())?jakirkham commentedon Jan 25, 2019
A PR for this would be welcome. Assuming of course that this list isn’t missing some things.
deeplycloudy commentedon Jul 23, 2019
I too had a need for
histogram2dtoday, and so I made a run at what @mrocklin said should be possible. Below is an example that takes anxarraydataset and the names of the two variables to be histogrammed, as well as a tuple of explicit bin edges.For my use case, I've preprocessed many large satellite images to select some pixels of interest that are stored in the
xarraydatasetglm_5_min. It has two data variables,flash_extent_densityandaverage_flash_area, for which I have specified some explicit bin edges as numpy arrays. Callingdask_histogram2dlooks like this:reshapedhas the same shape as thehistoreturned bynp.histogram2d.I don't understand why
histohas the shape it does. Figuring out that the number of blocks was the middle dimension took a couple hours of trial and error, probably because I don't understand howmap_blocksworks.I don't have time to turn this into a real PR right now, but if someone does feel free to run with it.
dhruvbalwada commentedon Jul 23, 2019
@deeplycloudy - could also look at https://xhistogram.readthedocs.io/ , which has been trying to address this. From personal experience it works quite smoothly :)
deeplycloudy commentedon Jul 23, 2019
@dhruvbalwada Ah, very nice! Yes, a fully generalized, label-aware histogram is certainly useful. I'd love to see relevant parts upstreamed into xarray, dask, or even numpy. @mrocklin gave a nice talk at SciPy about the benefit of and need to work toward a unified, user-facing API across various libraries, and this is a great illustration of something universally useful that has to exist as a separate package right now. It makes it not as discoverable for folks starting from numpy and growing into dask/xarray.
fredericoschardong commentedon May 9, 2020
Is there any particular reason not to include
left_shiftandright_shift?jakirkham commentedon May 9, 2020
They are in the list 🙂
It's worth noting that they are
ufuncs. So you should just be able to use NumPy's functions on Dask Arrays as-is and things will be handled correctly under-the-hood 😉jakirkham commentedon May 5, 2022
Also this listing/comparison may be useful