datatable.rowfirst()

For each row, find the first non-missing value in cols. If all values in a row are missing, then this function will also produce a missing value.

Parameters

cols
FExpr

Input columns.

return
FExpr

f-expression consisting of one column and the same number of rows as in cols.

except
TypeError

The exception is raised when input columns have incompatible types.

Examples

from datatable import dt, f DT = dt.Frame({"A": [1, 1, 2, 1, 2], "B": [None, 2, 3, 4, None], "C": [True, False, False, True, True]}) DT
ABC
int32int32bool8
01NA1
1120
2230
3141
42NA1
DT[:, dt.rowfirst(f[:])]
C0
int32
01
11
22
31
42
DT[:, dt.rowfirst(f['B', 'C'])]
C0
int32
01
12
23
34
41

See Also

  • rowlast() – find the last non-missing value row-wise.