Files
2026-02-08 11:20:43 -10:00

2.8 KiB
Vendored

Removes all rows that satisfy row condition

Related operations:

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

dropNulls

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

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

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

dropNaNs

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

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

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

dropNA

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

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

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