datatable.rowargmax()

Added in version 1.1.0

For each row, find the index of the largest value among the columns from cols. When the largest value occurs more than once, the smallest column index is returned.

Parameters

cols
FExpr

Input columns.

return
FExpr

f-expression consisting of one column that has the same number of rows as in cols. The column type is int64.

except
TypeError

The exception is raised when cols has non-numeric columns.

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.rowargmax(f[:])]
C0
int64
00
11
21
31
40

See Also

  • rowargmin() – find the index of the smallest element row-wise.