Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
Parses the expression string into the column that it represents. Supports Spark Connect.
Syntax
from pyspark.sql import functions as dbf
dbf.expr(str=<str>)
Parameters
| Parameter | Type | Description |
|---|---|---|
str |
str |
Expression defined in string. |
Returns
pyspark.sql.Column: column representing the expression.
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([["Alice"], ["Bob"]], ["name"])
df.select("*", dbf.expr("length(name)")).show()
+-----+------------+
| name|length(name)|
+-----+------------+
|Alice| 5|
| Bob| 3|
+-----+------------+