pyspark.sql.functions.every#
- pyspark.sql.functions.every(col)[source]#
Aggregate function: returns true if all values of col are true.
New in version 3.5.0.
- Parameters
- col
Column
or str column to check if all values are true.
- col
- Returns
Column
true if all values of col are true, false otherwise.
Examples
>>> import pyspark.sql.functions as sf >>> spark.createDataFrame( ... [[True], [True], [True]], ["flag"] ... ).select(sf.every("flag")).show() +-----------+ |every(flag)| +-----------+ | true| +-----------+
>>> import pyspark.sql.functions as sf >>> spark.createDataFrame( ... [[True], [False], [True]], ["flag"] ... ).select(sf.every("flag")).show() +-----------+ |every(flag)| +-----------+ | false| +-----------+
>>> import pyspark.sql.functions as sf >>> spark.createDataFrame( ... [[False], [False], [False]], ["flag"] ... ).select(sf.every("flag")).show() +-----------+ |every(flag)| +-----------+ | false| +-----------+