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.
Remove the leading and trailing trim characters from str.
For the corresponding Databricks SQL function, see btrim function.
Syntax
from pyspark.sql import functions as dbf
dbf.btrim(str=<str>, trim=<trim>)
Parameters
| Parameter | Type | Description |
|---|---|---|
str |
pyspark.sql.Column or str |
Input column or strings. |
trim |
pyspark.sql.Column or str, optional |
The trim string characters to trim, the default value is a single space Examples -------- >>> df = spark.createDataFrame([("SSparkSQLS", "SL", )], ['a', 'b']) >>> df.select(btrim(df.a, df.b).alias('r')).collect() [Row(r='parkSQ')] >>> df = spark.createDataFrame([(" SparkSQL ",)], ['a']) >>> df.select(btrim(df.a).alias('r')).collect() [Row(r='SparkSQL')] |
Examples
df = spark.createDataFrame([("SSparkSQLS", "SL", )], ['a', 'b'])
df.select(btrim(df.a, df.b).alias('r')).collect()
df = spark.createDataFrame([(" SparkSQL ",)], ['a'])
df.select(btrim(df.a).alias('r')).collect()