datatable.Frame.colindex()¶
Return the position of the column
in the Frame.
The index of the first column is 0
, just as with regular python
lists.
Parameters¶
str
| int
| FExpr
If string, then this is the name of the column whose index you want to find.
If integer, then this represents a column’s index. The return
value is thus the same as the input argument column
, provided
that it is in the correct range. If the column
argument is
negative, then it is interpreted as counting from the end of the
frame. In this case the positive value column + ncols
is
returned.
Lastly, column
argument may also be an
f-expression such as f.A
or f[3]
. This
case is treated as if the argument was simply "A"
or 3
. More
complicated f-expressions are not allowed and will result in a
TypeError
.
int
The numeric index of the provided column
. This will be an
integer between 0
and self.ncols - 1
.
KeyError
| IndexError
raised if the |
|
raised if the |
Examples¶
df = dt.Frame(A=[3, 14, 15], B=["enas", "duo", "treis"],
C=[0, 0, 0])
df.colindex("B")
df.colindex(-1)
from datatable import f
df.colindex(f.A)