dropna() Method | Teradata Python Package - dropna() Method - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Publication Date
March 2025
Content Type
User Guide
Publication ID
B700-4006-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
ft:sourceId
dita
dita:id
rkb1531260709148
Product Category
Teradata Vantage

Use the dropna() method to remove rows with null values in a DataFrame.

This method does not support operations on array columns.

Optional Parameters

how
Specifies how rows are removed. It has options 'any' or 'all'.
  • 'any': Removes rows with at least one null value.
  • 'all': Removes rows with all null values.

Default value: 'any'

thresh
Specifies the minimum number of non-null values in a row to include.
subset
Specifies list of column names to include, in array-like format. Use this argument to limit the search for null values to specific columns.

Example 1: Drop rows with at least one Null value

>>> df.dropna()
                Feb  Jan  Mar  Apr    datetime
accounts
Blue Inc       90.0   50   95  101  2017-04-01
Jones LLC     200.0  150  140  180  2017-04-01
Alpha Co      210.0  200  215  250  2017-04-01

Example 2: Keep rows with at least four Non-Null values

>>> df.dropna(thresh=4)
              Feb   Jan   Mar   Apr    datetime
accounts
Jones LLC   200.0   150   140   180  2017-04-01
Blue Inc     90.0    50    95   101  2017-04-01
Orange Inc  210.0  None  None   250  2017-04-01
Alpha Co    210.0   200   215   250  2017-04-01
Red Inc     200.0   150   140  None  2017-04-01

Example 3: Keep rows with at least five Non-Null values

>>> df.dropna(thresh=5)
             Feb  Jan  Mar   Apr    datetime
accounts
Alpha Co   210.0  200  215   250  2017-04-01
Jones LLC  200.0  150  140   180  2017-04-01
Blue Inc    90.0   50   95   101  2017-04-01
Red Inc    200.0  150  140  None  2017-04-01

Example 4: Drop rows with all Null values in columns 'Jan' and 'Mar'

>>> df.dropna(how='all', subset=['Jan','Mar'])
             Feb  Jan  Mar   Apr    datetime
accounts
Alpha Co   210.0  200  215   250  2017-04-01
Jones LLC  200.0  150  140   180  2017-04-01
Red Inc    200.0  150  140  None  2017-04-01
Blue Inc    90.0   50   95   101  2017-04-01