Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the negative value. Supports Spark Connect.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.negate(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
column to calculate negative value for. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(-1,), (0,), (1,)], ["value"])
df.select("*", dbf.negative(df.value)).show()
+-----+---------------+
|value|negative(value)|
+-----+---------------+
| -1| 1|
| 0| 0|
| 1| -1|
+-----+---------------+