---
title: bool_and
description: "bool\\_and function in PySpark: Returns true if all values of col are true."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/functions/bool_and
---

# bool\_and

Returns true if all values of col are true.

## Syntax

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

sf.bool_and(col)
```

## Parameters

| Parameter | Type                                | Description                             |
| --------- | ----------------------------------- | --------------------------------------- |
| `col`     | `pyspark.sql.Column` or column name | Column to check if all values are true. |

## Returns

`pyspark.sql.Column`: true if all values of `col` are true, false otherwise.

## Examples

```python
import pyspark.sql.functions as sf
df = spark.createDataFrame([[True], [True], [True]], ["flag"])
df.select(sf.bool_and("flag")).show()
```

```Output
+--------------+
|bool_and(flag)|
+--------------+
|          true|
+--------------+
```

```python
import pyspark.sql.functions as sf
df = spark.createDataFrame([[True], [False], [True]], ["flag"])
df.select(sf.bool_and("flag")).show()
```

```Output
+--------------+
|bool_and(flag)|
+--------------+
|         false|
+--------------+
```
