pyspark.sql.functions.
expr
Parses the expression string into the column that it represents
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
expression defined in string.
Column
column representing the expression.
Examples
>>> df = spark.createDataFrame([["Alice"], ["Bob"]], ["name"]) >>> df.select("name", expr("length(name)")).show() +-----+------------+ | name|length(name)| +-----+------------+ |Alice| 5| | Bob| 3| +-----+------------+