Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import dask
- import dask.array as da
- arr = da.from_array([1, 1, 1, 2, 3, 4, 4])
- unique, counts = da.unique(arr, return_counts=True)
- unique, counts = dask.compute(unique, counts)
- result = dict(zip(unique, counts))
- # {1: 3, 2: 1, 3: 1, 4: 2}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement