daft.Expression.str.rpad#
- Expression.str.rpad(length: int | daft.expressions.expressions.Expression, pad: str | daft.expressions.expressions.Expression) Expression [source]#
Right-pads each string by truncating or padding with the character
Note
If the string is longer than the specified length, it will be truncated. The pad character must be a single character.
Example
>>> import daft >>> df = daft.from_pydict({"x": ["daft", "query", "engine"]}) >>> df = df.select(df["x"].str.rpad(6, "0")) >>> df.show() ╭────────╮ │ x │ │ --- │ │ Utf8 │ ╞════════╡ │ daft00 │ ├╌╌╌╌╌╌╌╌┤ │ query0 │ ├╌╌╌╌╌╌╌╌┤ │ engine │ ╰────────╯ (Showing first 3 of 3 rows)
- Returns:
a String expression which is
self
truncated or right-padded with the pad character- Return type:
Expression