Skip to content

Instantly share code, notes, and snippets.

@kristoff-it
Last active July 16, 2019 08:03
Show Gist options
  • Save kristoff-it/cd4c3ec8125a7ffb396f9aa98591adbd to your computer and use it in GitHub Desktop.
Save kristoff-it/cd4c3ec8125a7ffb396f9aa98591adbd to your computer and use it in GitHub Desktop.
> 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