pyspark.sql.functions.concat_ws

pyspark.sql.functions.concat_ws(sep: str, *cols: ColumnOrName) → pyspark.sql.column.Column[source]

Concatenates multiple input string columns together into a single string column, using the given separator.

New in version 1.5.0.

Examples

>>> df = spark.createDataFrame([('abcd','123')], ['s', 'd'])
>>> df.select(concat_ws('-', df.s, df.d).alias('s')).collect()
[Row(s='abcd-123')]