Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Remove the leading and trailing trim characters from str.
For the corresponding Databricks SQL function, see btrim function.
Syntax
from pyspark.databricks.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()