GroupByPivotMatchesCommonDocs

Computes a presence matrix (similar to one-hot 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 a Boolean value indicating whether a row with the corresponding combination of values (horizontal and vertical) exists in the DataFrame.

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

This can include column groups and nested columns.

See Selecting Columns.

For more information: See pivotMatches on the documentation website.

See also: pivotCounts, which performs a similar operation but counts the number of matching rows instead of checking for their presence.

This pivotMatches Overload