BlueMountainCapital/Deedle — pull request #148 by adamklein (2014-02-10 21:00:06+00:00)
Title: Improve Frame groupBy semantics

The current suite of Frame.groupBy functions suffers a few problems:
- it forces an unnest after grouping, but you often just re-nest immediately to do an operation
- it operates row-wise, but should operate column-wise

This pull request addresses these issues. On the following benchmark, I get approx 10x speedup.

let genRandomNumbers count =
let rnd = System.Random()
List.init count (fun _ -> (float <| rnd.Next()) / (float Int32.MaxValue))

let r = genRandomNumbers 1000000
let x = [for i in r -> if i > 0.0 then "x" else "y" ]
let s = Series.ofValues(x)
let n = Series.ofValues(r)
let f = Frame.ofColumns ["s" => s]
f?n <- n

let means = f |> Frame.groupRowsByString("s") |> Series.mapValues (fun s -> s?n |> Series.mean)