pyspark.sql.functions.some#

pyspark.sql.functions.some(col)[source]#

Aggregate function: returns true if at least one value of col is true.

Added in version 3.5.0.

Parameters:
colColumn or column name

column to check if at least one value is true. A column that evaluates to a boolean.

Returns:
Column

true if at least one value of col is true, false otherwise.

Examples

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