pandas.Series.str.rjust #

系列.str。rjust ( width , fillchar = ' ' ) [来源] #

填充系列/索引中字符串的左侧。

相当于str.rjust()

参数
宽度整数

结果字符串的最小宽度;附加字符将用 填充fillchar

填充字符字符串

用于填充的附加字符,默认为空白。

返回
对象的系列/索引。

例子

对于Series.str.center:

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

对于Series.str.ljust:

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

对于Series.str.rjust:

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