Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Concatenates multiple input string columns together into a single string column, using the given separator.
For the corresponding Databricks SQL function, see concat_ws function.
Syntax
from pyspark.sql import functions as dbf
dbf.concat_ws(sep=<sep>, *cols=<*cols>)
Parameters
| Parameter | Type | Description |
|---|---|---|
sep |
literal string |
words separator. |
cols |
pyspark.sql.Column or str |
list of columns to work on. |
Returns
pyspark.sql.Column: string of concatenated words.
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([("abcd", "123")], ["s", "d"])
df.select("*", dbf.concat_ws("-", df.s, "d", dbf.lit("xyz"))).show()