isEmpty
Returns true if DataFrame has no rows or no columns.
Removing all columns with remove keeps the number of rows, so a DataFrame can have rows and no columns. Such a dataframe holds no values, so it counts as empty as well as one without rows.
A ColumnGroup is a DataFrame too, and both cases apply to it: a column group is empty when it has no nested columns, or when the dataframe that holds it has no rows.
Nested dataframes of a FrameColumn are not taken into account: a dataframe whose frame column holds only empty dataframes — after groupBy, for example — is not empty itself.
The examples below use this DataFrame:
name | age |
|---|---|
Alice | 15 |
Charlie | 40 |
isNotEmpty
Returns true if DataFrame has at least one row and at least one column, that is, if it is not empty.
With the same two-row df as above:
See also rowsCount() and columnsCount() — the two numbers behind these checks, and emptyDataFrame() for creating an empty dataframe.