Series.str.pad(self, width, side='left', fillchar=' ')
[source]
Pad strings in the Series/Index up to width.
Parameters: |
|
---|---|
Returns: |
|
See also
Series.str.rjust
Series.str.pad(side='left')
.Series.str.ljust
Series.str.pad(side='right')
.Series.str.center
Series.str.pad(side='both')
.Series.str.zfill
Series.str.pad(side='left', fillchar='0')
.>>> s = pd.Series(["caribou", "tiger"]) >>> s 0 caribou 1 tiger dtype: object
>>> s.str.pad(width=10) 0 caribou 1 tiger dtype: object
>>> s.str.pad(width=10, side='right', fillchar='-') 0 caribou--- 1 tiger----- dtype: object
>>> s.str.pad(width=10, side='both', fillchar='-') 0 -caribou-- 1 --tiger--- dtype: object
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.str.pad.html