datatable.countna()

Added in version 1.1.0

Count the number of NA values for each column from cols.

Parameters

cols
Expr

Input columns.

return
Expr

f-expression having one row, and the same names and number of columns as in cols. All the returned column stypes are int64.

except
TypeError

The exception is raised when one of the columns from cols has an obj64 type.

Examples

from datatable import dt, f df = dt.Frame({'A': [1, 1, 2, None, 1, 2], 'B': [None, 2, 3, 4, None, 5], 'C': [1, 2, 1, 1, 2, 4]}) df
ABC
int32int32int32
01NA1
1122
2231
3NA41
41NA2
5254

Get the count of NAs of all rows:

df[:, dt.countna(f[:])]
ABC
int64int64int64
0120

Get the count of NAs of column B:

df[:, dt.countna(f.B)]
B
int64
02

See Also

  • count() – function to count the number of non-missing values.