turicreate.aggregate.CONCAT

turicreate.aggregate.CONCAT(src_column, dict_value_column=None)

Builtin aggregator that combines values from one or two columns in one group into either a dictionary value or list value.

If only one column is given, then the values of this column are aggregated into a list. Order is not preserved. For example:

>>> sf.groupby(["user"],
...     {"friends": tc.aggregate.CONCAT("friend")})

would form a new column “friends” containing values in column “friend” aggregated into a list of friends.

If dict_value_column is given, then the aggregation forms a dictionary with the keys taken from src_column and the values taken from dict_value_column. For example:

>>> sf.groupby(["document"],
...     {"word_count": tc.aggregate.CONCAT("word", "count")})

would aggregate words from column “word” and counts from column “count” into a dictionary with keys being words and values being counts.