polars.Series.str.ljust#

Series.str.ljust(width: int, fill_char: str = ' ') Series[source]#

Return the string left justified in a string of length width.

Padding is done using the specified fill_char. The original string is returned if width is less than or equal to``len(s)``.

Parameters:
width

Justify left to this length.

fill_char

Fill with this ASCII character.

Examples

>>> s = pl.Series("a", ["cow", "monkey", None, "hippopotamus"])
>>> s.str.ljust(8, "*")
shape: (4,)
Series: 'a' [str]
[
    "cow*****"
    "monkey**"
    null
    "hippopotamus"
]