pyspark.sql.functions.positive#
- pyspark.sql.functions.positive(col)[source]#
Returns the value.
Added in version 3.5.0.
- Parameters:
- col
Columnor column name input value column. A column that evaluates to a numeric or interval.
- col
- Returns:
Columnvalue. 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| +-----+---------+