snowflake.snowpark.functions.summarize_agg

snowflake.snowpark.functions.summarize_agg(expr: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.30.0/snowpark-python/src/snowflake/snowpark/functions.py#L12042-L12071)

Summarizes a column of text data.

Parameters:

expr – This is an expression that contains text for summarization, such as restaurant reviews or phone transcripts.

Example:

>>> df = session.create_dataframe([
...     [1, "Excellent"],
...     [1, "Excellent"],
...     [1, "Great"],
...     [1, "Mediocre"],
...     [2, "Terrible"],
...     [2, "Bad"],
... ], schema=["product_id", "review"])
>>> summary_df = df.select(summarize_agg(col("review")))
>>> summary_df.count()
1
>>> summary_df = df.group_by("product_id").agg(summarize_agg(col("review")))
>>> summary_df.count()
2


This function or method is in private preview since 1.29.0.
Copy
Language: English