pyspark.sql.functions.btrim#
- pyspark.sql.functions.btrim(str, trim=None)[source]#
Remove the leading and trailing trim characters from str.
New in version 3.5.0.
- Parameters
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')]