Index.repeat(self, repeats, axis=None)
[source]
Repeat elements of a Index.
Returns a new Index where each element of the current Index is repeated consecutively a given number of times.
Parameters: |
|
---|---|
Returns: |
|
See also
Series.repeat
numpy.repeat
numpy.ndarray
.>>> idx = pd.Index(['a', 'b', 'c']) >>> idx Index(['a', 'b', 'c'], dtype='object') >>> idx.repeat(2) Index(['a', 'a', 'b', 'b', 'c', 'c'], dtype='object') >>> idx.repeat([1, 2, 3]) Index(['a', 'b', 'b', 'c', 'c', 'c'], 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.Index.repeat.html