---
title: sqrt
description: "sqrt function in PySpark: Computes the square root of the specified float value."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/functions/sqrt
---

# sqrt

Computes the square root of the specified float value. Supports Spark Connect.

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

## Syntax

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

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

## Parameters

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

## Returns

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

## Examples

```python
from pyspark.sql import functions as dbf
spark.sql(
    "SELECT * FROM VALUES (-1), (0), (1), (4), (NULL) AS TAB(value)"
).select("*", dbf.sqrt("value")).show()
```

```Output
+-----+-----------+
|value|SQRT(value)|
+-----+-----------+
|   -1|        NaN|
|    0|        0.0|
|    1|        1.0|
|    4|        2.0|
| NULL|       NULL|
+-----+-----------+
```
