Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extend `dask.compute` to work on nested data structures. | |
from toolz import concat | |
from dask import compute | |
def _flatten_compute(vals): | |
if isinstance(vals, list): | |
inner = list(concat(map(_flatten_compute, vals))) | |
return ['list', len(inner)] + inner | |
elif isinstance(vals, dict): | |
inner = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function groupby(func, seq) | |
local t = {} | |
for _, val in ipairs(seq) do | |
local key = func(val) | |
t[key] = t[key] or {} | |
t[key][#t[key] + 1] = val | |
end | |
return t | |
end |
NewerOlder