pyspark.RDD.isEmpty

RDD.isEmpty() → bool[source]

Returns true if and only if the RDD contains no elements at all.

New in version 1.3.0.

Returns
bool

whether the RDD is empty

Notes

An RDD may be empty even when it has at least 1 partition.

Examples

>>> sc.parallelize([]).isEmpty()
True
>>> sc.parallelize([1]).isEmpty()
False