Notiz
Zougrëff op dës Säit erfuerdert Autorisatioun. Dir kënnt probéieren, Iech unzemellen oder Verzeechnesser ze änneren.
Zougrëff op dës Säit erfuerdert Autorisatioun. Dir kënnt probéieren, Verzeechnesser ze änneren.
Returns the leftmost len(len can be string type) characters from the string str, if len is less or equal than 0 the result is an empty string.
For the corresponding Databricks SQL function, see left function.
Syntax
from pyspark.sql import functions as dbf
dbf.left(str=<str>, len=<len>)
Parameters
| Parameter | Type | Description |
|---|---|---|
str |
pyspark.sql.Column or str |
Input column or strings. |
len |
pyspark.sql.Column or str |
Input column or strings, the leftmost len. Examples -------- >>> df = spark.createDataFrame([("Spark SQL", 3,)], ['a', 'b']) >>> df.select(left(df.a, df.b).alias('r')).collect() [Row(r='Spa')] |
Examples
df = spark.createDataFrame([("Spark SQL", 3,)], ['a', 'b'])
df.select(left(df.a, df.b).alias('r')).collect()