cudf.core.column.string.StringMethods.ljust#

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

Filling right side of strings in the Series/Index with an additional character. Equivalent to str.ljust().

Parameters:
widthint

Minimum width of resulting string; additional characters will be filled with fillchar.

fillcharstr, default ‘ ‘ (whitespace)

Additional character for filling, default is whitespace.

Returns:
Series/Index of str dtype

Returns Series or Index.

Examples

>>> import cudf
>>> s = cudf.Series(["hello world", "rapids ai"])
>>> s.str.ljust(10, fillchar="_")
0    hello world
1     rapids ai_
dtype: object
>>> s = cudf.Series(["a", "",  "ab", "__"])
>>> s.str.ljust(1, fillchar="-")
0     a
1     -
2    ab
3    __
dtype: object