SHARE
TWEET

Untitled

a guest Jun 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import dask
  2. import dask.array as da
  3.  
  4. arr = da.from_array([1, 1, 1, 2, 3, 4, 4])
  5.  
  6. unique, counts = da.unique(arr, return_counts=True)
  7.  
  8. unique, counts = dask.compute(unique, counts)
  9. result = dict(zip(unique, counts))
  10. # {1: 3, 2: 1, 3: 1, 4: 2}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top