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 groupscorresponding to value combinations when usingthen, similar topivot);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
keysinGroupBy).Cells contain a
Booleanvalue indicating whether a row with the corresponding combination of values (horizontal and vertical) exists in theDataFrame.
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.