maxframe.dataframe.Series.str.rjust#

Series.str.rjust(width: int, fillchar: str = ' ')#

在 Series/Index 中字符串的左侧填充。

等效于 str.rjust()

参数:
  • width (int) -- 结果字符串的最小宽度;额外字符将用 fillchar 填充。

  • fillchar (str) -- 用于填充的额外字符,默认为空格。

返回:

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

返回类型:

Series/Index of objects.

参见

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.

示例

对于 Series.str.center:

>>> import maxframe.dataframe as md
>>> ser = md.Series(["dog", "bird", "mouse"])
>>> ser.str.center(8, fillchar=".").execute()
0   ..dog...
1   ..bird..
2   .mouse..
dtype: str

对于 Series.str.ljust:

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

对于 Series.str.rjust:

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