FrameViewGroupBy Method (String, FuncFrameView, IReadOnlyDictionaryString, Object) |
Namespace: Meta.Numerics.Data
public FrameTable GroupBy( string groupByColumnName, Func<FrameView, IReadOnlyDictionary<string, Object>> aggregator )
The first column of the returned FrameTable has the same name as the original groupByColumnName and contains all the distinct values of that column in the original view. There is an additional column for each dictionary entry returned by aggregator, whose name is the returned key and whose values are values returned for each group.
The function that computes the aggregate receives a FrameView containing all the rows in the group. To produce aggregate results, it can use values in any of the columns. Each invocation of the aggregator must return the same keys and values for the same keys must be of the same type. (Values for different keys may be of different types.) Aggregate column names are taken from the keys and storage types are inferred from the returned values.
To produce just one aggregate value, you may find it simpler and more efficient to use the GroupBy(String, FuncFrameView, IReadOnlyDictionaryString, Object) overload.