Skip to main content

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|
+--------------+