pyspark.sql.functions.positive#

pyspark.sql.functions.positive(col)[source]#

Returns the value.

Added in version 3.5.0.

Parameters:
colColumn or column name

input value column. A column that evaluates to a numeric or interval.

Returns:
Column

value. Returns a column of the same type as the input.

Examples

>>> import pyspark.sql.functions as sf
>>> df = spark.createDataFrame([(-1,), (0,), (1,)], ["value"])
>>> df.select("*", sf.positive(df.value)).show()
+-----+---------+
|value|(+ value)|
+-----+---------+
|   -1|       -1|
|    0|        0|
|    1|        1|
+-----+---------+