polars.internals.series.string.StringNameSpace.ljust#

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

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

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

Parameters:
width

Justify left to this length.

fillchar

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"
]