DataFrame 1.0 Help

drop / dropNulls / dropNaNs / dropNA

The examples on this page use the following dataframe:

df

drop

Removes all rows that satisfy row condition

Related operations: Filter rows

df.drop { weight == null || name == null }
df.drop { it["weight"] == null || it["name"] == null }

If called on a DataColumn, removes all the values that match the predicate and returns a DataColumn containing the values that do not match the predicate.

df.weight.drop { it != null && it < 60 }

dropNulls

Removes rows with null values. This is a DataFrame equivalent of filterNotNull.

See also fillNulls, which replaces null values instead of removing rows.

See column selectors for how to select the columns for this operation.

// remove rows with null value in any column df.dropNulls()
// remove rows with null values in all columns df.dropNulls(whereAllNull = true)
// remove rows with null value in 'name' column df.dropNulls { name }
// remove rows with null value in 'name' OR 'weight' columns df.dropNulls { name and weight }
// remove rows with nulls in both 'name' and 'weight' columns df.dropNulls(whereAllNull = true) { name and weight }

If called on a DataColumn, removes null values from this DataColumn, adjusting the type accordingly.

df.weight.dropNulls()

dropNaNs

Removes rows with NaN values (Double.NaN or Float.NaN).

See also fillNaNs, which replaces NaN values instead of removing rows.

See column selectors for how to select the columns for this operation.

// remove rows containing NaN in any column df.dropNaNs()
// remove rows with NaN in all columns of type `Double?` df.dropNaNs(whereAllNaN = true) { colsOf<Double?>() }
// remove rows where 'weight' is NaN df.dropNaNs { weight }
// remove rows where either 'age' or 'weight' is NaN df.dropNaNs { age and weight }
// remove rows where both 'age' and 'weight' are NaN df.dropNaNs(whereAllNaN = true) { age and weight }

If called on a DataColumn, removes NaN values from this DataColumn, adjusting the type accordingly.

df.weight.dropNaNs()

dropNA

Removes rows with NA values (null, Double.NaN, or Float.NaN).

See also fillNA, which replaces NA values instead of removing rows.

See column selectors for how to select the columns for this operation.

// remove rows containing null or NaN in any column df.dropNA()
// remove rows with null or NaN in all columns df.dropNA(whereAllNA = true)
// remove rows where 'weight' is null or NaN df.dropNA { weight }
// remove rows where either 'age' or 'weight' is null or NaN df.dropNA { age and weight }
// remove rows where both 'age' and 'weight' are null or NaN df.dropNA(whereAllNA = true) { age and weight }

If called on a DataColumn, removes NA values from this DataColumn, adjusting the type accordingly.

df.weight.dropNA()
09 September 2026