pandas.Series.str.rjust

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

param width
int

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

param fillchar
str

Additional character for filling, default is whitespace

return

filled : Series/Index of objects

Examples

Filling left side of strings in the Series with an additional character
import pandas as pd
from numba import njit


@njit
def series_str_rjust():
    series = pd.Series(['dog', 'foo', 'bar'])  # Series of 'dog', 'foo', 'bar'
    out_series = series.str.rjust(5, '*')

    return out_series  # Expect series of '**dog', '**foo', '**bar'


print(series_str_rjust())
$ python ./series/str/series_str_rjust.py
0    **dog
1    **foo
2    **bar
dtype: object

See also

Series.str.ljust

Fills the right side of strings with an arbitrary character.

Series.str.center

Fills boths sides of strings with an arbitrary character.

Todo

Add support of 32-bit Unicode for str.rjust()