GroupByPivotCountsCommonDocs

Computes a count matrix (similar to frequency encoding) for the values in the specified columns within each group of this GroupBy, returning a new DataFrame where:

  • Columns represent all unique values from the selected columns (they become column groups corresponding to value combinations when using then, similar to pivot);

  • Rows correspond to all unique combinations of values from the grouping columns; each combination is represented in dedicated key columns that store a distinct set of values for each row (similar to keys in GroupBy).

  • Cells contain an Int value indicating how many rows with the corresponding combination of values (horizontal and vertical) exist in the DataFrame.

This function combines pivot and count operations into a single call.

This can include column groups and nested columns.

See Selecting Columns.

For more information: See pivotCounts on the documentation website.

See also: pivotMatches, which performs a similar operation but checks if there is any matching row instead of counting them.

This pivotCounts Overload