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
Copyright (c) 2018 Erik Welch | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
a. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
b. Redistributions in binary form must reproduce the above copyright |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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