---
title: negative
description: "negative function in PySpark: Returns the negative value."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/functions/negative
---

# negative

Returns the negative value. Supports Spark Connect.

For the corresponding Databricks SQL function, see [`negative` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/negative.md).

## Syntax

```python
from pyspark.sql import functions as dbf

dbf.negative(col=<col>)
```

## Parameters

| Parameter | Type                                | Description                             |
| --------- | ----------------------------------- | --------------------------------------- |
| `col`     | `pyspark.sql.Column or column name` | column to calculate negative value for. |

## Returns

`pyspark.sql.Column`: negative value.

## Examples

```python
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(-1,), (0,), (1,)], ["value"])
df.select("*", dbf.negative(df.value)).show()
```

```Output
+-----+---------------+
|value|negative(value)|
+-----+---------------+
|   -1|              1|
|    0|              0|
|    1|             -1|
+-----+---------------+
```
