Series.str.repeat(self, repeats)
[source]
Duplicate each string in the Series or Index.
Parameters: |
|
---|---|
Returns: |
|
>>> s = pd.Series(['a', 'b', 'c']) >>> s 0 a 1 b 2 c dtype: object
Single int repeats string in Series
>>> s.str.repeat(repeats=2) 0 aa 1 bb 2 cc dtype: object
Sequence of int repeats corresponding string in Series
>>> s.str.repeat(repeats=[1, 2, 3]) 0 a 1 bb 2 ccc 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.repeat.html