Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Checks if the DataFrame is empty and returns a boolean value.
Syntax
isEmpty()
Returns
bool: Returns True if the DataFrame is empty, False otherwise.
Notes
An empty DataFrame has no rows. It may have columns, but no data.
Examples
df_empty = spark.createDataFrame([], 'a STRING')
df_empty.isEmpty()
# True
df_non_empty = spark.createDataFrame(["a"], 'STRING')
df_non_empty.isEmpty()
# False
df_nulls = spark.createDataFrame([(None, None)], 'a STRING, b INT')
df_nulls.isEmpty()
# False
df_no_rows = spark.createDataFrame([], 'id INT, value STRING')
df_no_rows.isEmpty()
# True