daft.Expression.str.lpad

daft.Expression.str.lpad#

Expression.str.lpad(length: int | daft.expressions.expressions.Expression, pad: str | daft.expressions.expressions.Expression) Expression[source]#

Left-pads each string by truncating on the right or padding with the character

Note

If the string is longer than the specified length, it will be truncated on the right. The pad character must be a single character.

Example

>>> col("x").str.lpad(5, "0")
Returns:

a String expression which is self truncated or left-padded with the pad character

Return type:

Expression