---
title: signum
description: "signum function in PySpark: Computes the signum of the given value."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/functions/signum
---

# signum

Computes the signum of the given value. Supports Spark Connect.

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

## Syntax

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

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

## Parameters

| Parameter | Type                                | Description                  |
| --------- | ----------------------------------- | ---------------------------- |
| `col`     | `pyspark.sql.Column or column name` | target column to compute on. |

## Returns

`pyspark.sql.Column`: the column for computed results.

## Examples

```python
from pyspark.sql import functions as dbf
spark.range(1).select(
    dbf.signum(dbf.lit(-5)),
    dbf.signum(dbf.lit(6)),
    dbf.signum(dbf.lit(float('nan'))),
    dbf.signum(dbf.lit(None))
).show()
```

```Output
+----------+---------+-----------+------------+
|SIGNUM(-5)|SIGNUM(6)|SIGNUM(NaN)|SIGNUM(NULL)|
+----------+---------+-----------+------------+
|      -1.0|      1.0|        NaN|        NULL|
+----------+---------+-----------+------------+
```
