mapToFrames

Returns a FrameColumn with the dataframes that body computes from the key–group pairs of this GroupBy.

body is called once for every key–group pair of this GroupBy, in the order in which the pairs appear in it. Each pair is given to body as a GroupWithKey, both as the receiver and as the argument, so the key values are available as key and the rows of the group as group.

The new column has one DataFrame per key–group pair, in the same order, and the same name as groups.

Call concat() on the result to get all of those dataframes back as one DataFrame.

See also:

Example

// The two oldest people for each first name, as a frame column:
// every frame keeps all the columns of the original, including the first name it was grouped by
df.groupBy { name.firstName }.mapToFrames { group.sortByDesc { age }.take(2) }

For more information: See map on a GroupBy on the documentation website.

Return

A FrameColumn with one computed DataFrame per key–group pair.

Parameters

body

A Selector that computes a DataFrame from a key–group pair.