snowflake.snowpark.functions.listagg¶
- snowflake.snowpark.functions.listagg(e: Union[Column, str], delimiter: str = '', is_distinct: bool = False) Column [source]¶
Returns the concatenated input values, separated by delimiter string. See LISTAGG for details.
- Parameters:
e – A
Column
object or column name that determines the values to be put into the list.delimiter – A string delimiter.
is_distinct – Whether the input expression is distinct.
Examples:
>>> df = session.create_dataframe([1, 2, 3, 2, 4, 5], schema=["col"]) >>> df.select(listagg("col", ",").within_group(df["col"].asc()).as_("result")).collect() [Row(RESULT='1,2,2,3,4,5')]