datatable.rowlast()

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

Parameters

cols
Expr

Input columns.

return
Expr

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.rowlast(f[:])]
C0
int32
01
10
20
31
41
DT[[1, 3], 'C'] = None DT
ABC
int32int32bool8
01NA1
112NA
2230
314NA
42NA1
DT[:, dt.rowlast(f[:])]
C0
int32
01
12
20
34
41

See Also

  • rowfirst() – find the first non-missing value row-wise.