graph
graph copied to clipboard
No such property: mean for class: groovysh_evaluate
g.withSideEffect("m",mean).withSideEffect("c",count).V().hasLabel('airport').values('runways').math('(_ - m)^2').sum().math('_ / c').math('sqrt(_)')
No such property: mean for class: groovysh_evaluate
Type ':help' or ':h' for help.
Display stack trace? [yN]
3.29.6. Calculating a standard deviation
It is calculated in the example two above above in the same chapter
mean=g.V().hasLabel('airport').values('runways').mean().next()
1.4309425014819206
I should probably add an example that does the whole thing in one query.
gremlin> g.V().hasLabel('airport').
......1> values('runways').fold().as('runways').
......2> mean(local).as('mean').
......3> select('runways').unfold().
......4> math('(_-mean)^2').mean().math('sqrt(_)')
==>0.7510927827902234
gremlin>
Closing as this is fixed and work has now started on the second edition. There will likely be one final release of the v283 first edition line before the V2 branch becomes the second edition. That release will include these fixes.