Gets the n (from nchars) right-most characters of each string.
Returns:
| Name | Type | Description |
Expression | Expression | a String expression which is the n right-most characters of self |
Examples:
| >>> import daft
>>> from daft.functions import right
>>> df = daft.from_pydict({"x": ["daft", "distributed", "engine"]})
>>> df = df.select(right(df["x"], 4))
>>> df.show()
|
╭────────╮
│ x │
│ --- │
│ String │
╞════════╡
│ daft │
├╌╌╌╌╌╌╌╌┤
│ uted │
├╌╌╌╌╌╌╌╌┤
│ gine │
╰────────╯
(Showing first 3 of 3 rows)
Source code in daft/functions/str.py
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765 | def right(expr: Expression, nchars: int | Expression) -> Expression:
"""Gets the n (from nchars) right-most characters of each string.
Returns:
Expression: a String expression which is the `n` right-most characters of `self`
Examples:
>>> import daft
>>> from daft.functions import right
>>> df = daft.from_pydict({"x": ["daft", "distributed", "engine"]})
>>> df = df.select(right(df["x"], 4))
>>> df.show()
╭────────╮
│ x │
│ --- │
│ String │
╞════════╡
│ daft │
├╌╌╌╌╌╌╌╌┤
│ uted │
├╌╌╌╌╌╌╌╌┤
│ gine │
╰────────╯
<BLANKLINE>
(Showing first 3 of 3 rows)
"""
return Expression._call_builtin_scalar_fn("right", expr, nchars)
|