Skip to main content
`Ctrl`+`K`

# pandas.Series.str.ljust

Series.str.ljust(width, fillchar=' ')

  Pad right side of strings in the Series/Index.

  Equivalent to `str.ljust()`.

  Parameters:
    width int

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

    fillchar str

      Additional character for filling, default is whitespace.

  Returns:
    Series/Index of objects.

      A Series or Index where the strings are modified by `str.ljust()`.

  See also

  `Series.str.rjust`

    Fills the left side of strings with an arbitrary character.

  `Series.str.ljust`

    Fills the right side of strings with an arbitrary character.

  `Series.str.center`

    Fills both sides of strings with an arbitrary character.

  `Series.str.zfill`

    Pad strings in the Series/Index by prepending ‘0’ character.

  Examples

  For Series.str.center:

      >>> ser = pd.Series(["dog", "bird", "mouse"])
      >>> ser.str.center(8, fillchar=".")
      0   ..dog...
      1   ..bird..
      2   .mouse..
      dtype: str

  For Series.str.ljust:

      >>> ser = pd.Series(["dog", "bird", "mouse"])
      >>> ser.str.ljust(8, fillchar=".")
      0   dog.....
      1   bird....
      2   mouse...
      dtype: str

  For Series.str.rjust:

      >>> ser = pd.Series(["dog", "bird", "mouse"])
      >>> ser.str.rjust(8, fillchar=".")
      0   .....dog
      1   ....bird
      2   ...mouse
      dtype: str