Ciaren

Drop nulls

Drop nulls — dropNulls

Remove rows with missing values.

Use cases

  • Discard records that are missing a required field (e.g. no amount).
  • Drop fully-empty rows while keeping partially-populated ones.

What it does

Drops rows where the target column(s) are null. With subset: ["amount"] only rows missing an amount are removed — rows with other nulls (like region) survive.

Before
order_idregionamount
1001North120.5
1002Southnull
1003null89
1004South42.25
4 rows · 3 cols
Drop nulls (subset=amount)
After
order_idregionamount
1001North120.5
1003null89
1004South42.25
3 rows · 3 cols

Configuration

Config keyTypeRequiredDescription
howstringNoany (default) drops a row with any null; all only if every value is null
subsetstring[]NoOnly consider these columns

Generated Python code

df_2 = df_1.dropna(subset='amount')

Tips & common mistakes

  • how: all needs a subset to be meaningful row-wise — pair it with the columns that define an "empty" row.
  • To keep rows and fill the gaps instead, use Fill nulls.

See also