pyspark.sql.DataFrame.isEmpty

DataFrame.isEmpty() → bool[source]

Returns True if this DataFrame is empty.

New in version 3.3.0.

Changed in version 3.4.0: Supports Spark Connect.

Returns
bool

Whether it’s empty DataFrame or not.

Examples

>>> df_empty = spark.createDataFrame([], 'a STRING')
>>> df_non_empty = spark.createDataFrame(["a"], 'STRING')
>>> df_empty.isEmpty()
True
>>> df_non_empty.isEmpty()
False