tangram.utils.one_hot_encoding
- tangram.utils.one_hot_encoding(l, keep_aggregate=False)
Given a sequence, returns a DataFrame with a column for each unique value in the sequence and a one-hot-encoding.
- Parameters
l (sequence) – List to be transformed.
keep_aggregate (bool) – Optional. If True, the output includes an additional column for the original list. Default is False.
- Returns
- A DataFrame with a column for each unique value in the sequence and a one-hot-encoding, and an additional
column with the input list if ‘keep_aggregate’ is True. The number of rows are equal to len(l).