pyspark.sql.functions.bool_or¶
-
pyspark.sql.functions.
bool_or
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ Aggregate function: returns true if at least one value of col is true.
New in version 3.5.0.
- Parameters
- col
Column
or str column to check if at least one value is true.
- col
- Returns
Column
true if at least one value of col is true, false otherwise.
Examples
>>> df = spark.createDataFrame([[True], [True], [True]], ["flag"]) >>> df.select(bool_or("flag")).show() +-------------+ |bool_or(flag)| +-------------+ | true| +-------------+ >>> df = spark.createDataFrame([[True], [False], [True]], ["flag"]) >>> df.select(bool_or("flag")).show() +-------------+ |bool_or(flag)| +-------------+ | true| +-------------+ >>> df = spark.createDataFrame([[False], [False], [False]], ["flag"]) >>> df.select(bool_or("flag")).show() +-------------+ |bool_or(flag)| +-------------+ | false| +-------------+