isNotEmpty
Returns true if this DataFrame has at least one row and at least one column, that is, if it is not empty.
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 is not empty itself.
For more information: See isNotEmpty on the documentation website.
See also:
isEmpty— the opposite check.rowsCountandcolumnsCount— the two numbers behind it.DataFrame.Empty,DataFrame.emptyandemptyDataFrame— create an emptyDataFrame.
Example
The examples below use this DataFrame, the same data as the isEmpty page on the documentation website:
| name | age |
|---|---|
| Alice | 15 |
| Charlie | 40 |
df.isNotEmpty() // true
df.filter { age > 100 }.isNotEmpty() // false: no row is leftReturn
true if this DataFrame has at least one row and at least one column, false otherwise.
Deprecated
This shortcut is deprecated. Will be ERROR in 1.1.
Replace with
values().any { it != null }