Last active
July 16, 2019 08:03
-
-
Save kristoff-it/cd4c3ec8125a7ffb396f9aa98591adbd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
> HSET vec:1 x 10 y 5 z 23 | |
(integer) 3 | |
> HSET vec:2 x 2 y 5 z 5 | |
(integer) 3 | |
> RG.PYEXECUTE 'import numpy; GearsBuilder().map(lambda x: [float(x["value"]["x"]), float(x["value"]["y"]), float(x["value"]["z"])]).accumulate(lambda a, x: x if a is None else numpy.mean([a, x], axis=0)).flatmap(lambda x: x.tolist()).run("vec:*")' | |
1) 1) "14.0" | |
2) "5.0" | |
3) "6.0" | |
2) (empty list or set) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment