isEmpty

Returns true if this 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 is not empty itself.

For more information: See isEmpty on the documentation website.

See also:

Example

The examples below use this DataFrame, the same data as the isEmpty page on the documentation website:

nameage
Alice15
Charlie40
df.isEmpty() // false
df.filter { age > 100 }.isEmpty() // true: no row is left
df.remove { all() }.isEmpty() // true: no column is left, while both rows are still there

Return

true if this DataFrame has no rows or no columns, false otherwise.


Deprecated

This shortcut is deprecated. Will be ERROR in 1.1.

Replace with

values().all { it == null }