Κοινοποίηση μέσω


bool_and

Returns true if all values of col are true.

Syntax

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

import pyspark.sql.functions as sf
df = spark.createDataFrame([[True], [True], [True]], ["flag"])
df.select(sf.bool_and("flag")).show()
+--------------+
|bool_and(flag)|
+--------------+
|          true|
+--------------+
import pyspark.sql.functions as sf
df = spark.createDataFrame([[True], [False], [True]], ["flag"])
df.select(sf.bool_and("flag")).show()
+--------------+
|bool_and(flag)|
+--------------+
|         false|
+--------------+