datatable.str.slice()¶
Apply slice [start:stop:step]
to each value in a column
of string
type.
Instead of this function you can directly apply a slice expression to the column expression:
- ``f.A[1:-1]`` is equivalent to
- ``dt.str.slice(f.A, 1, -1)``.
Parameters¶
col
FExpr[str]
The column to which the slice should be applied.
return
FExpr[str]
A column containing sliced string values from the source column.
Examples¶
DT = dt.Frame(A=["apples", "bananas", "cherries", "dates",
"eggplants", "figs", "grapes", "kiwi"])
DT[:, dt.str.slice(f.A, None, 5)]
A | ||
---|---|---|
str32 | ||
0 | apple | |
1 | banan | |
2 | cherr | |
3 | dates | |
4 | eggpl | |
5 | figs | |
6 | grape | |
7 | kiwi |
The content on this page is licensed under the Creative Commons Attribution 4.0 License
(CC BY 4.0) ,
and code samples are licensed under the MIT License.