PivotDocs

internal interface PivotDocs

Splits the rows of this DataFrame and groups them horizontally into new columns based on values from one or several provided columns of the original DataFrame.

Returns a Pivot — a dataframe-like structure that contains all unique combinations of key values as columns (or column groups for multiple keys) with a single row with the corresponding groups for each key combination (each represented as a DataFrame).

Works like DataFrame.groupBy but groups rows horizontally.

A Pivot can then be:

Pivoted columns can also be created inline (i.g. by creating a new column using expr or simply renaming the old one using named):

// Create a new column "newName" based on existing "oldName" values
// and pivot it:
df.pivot { expr("newName") { oldName.drop(5) } }

Check out Grammar.

This can include column groups and nested columns.

See Selecting Columns.

For more information: See pivot on the documentation website.

Types

Link copied to clipboard
typealias Aggregation = Nothing

Each Pivot group can be aggregated — that is, transformed into a new value, DataRow, or DataFrame — and then concatenated into a single DataRow composed of these aggregated results, with pivot keys as top-level columns or as column groups.

Link copied to clipboard

Provides predefined shortcuts for the most common statistical aggregation operations that can be applied to each group within a Pivot.

Link copied to clipboard
typealias Grammar = Nothing
Link copied to clipboard
typealias Grouping = Nothing

Pivot can be grouped with groupBy method. It will produce a PivotGroupBy.

Link copied to clipboard
typealias Reducing = Nothing

Each Pivot group can be collapsed into a single row and then concatenated into a new DataRow with these row values (or their derived representation) with pivot keys as top-level columns or as column groups.