pandas.IntervalArray.repeat¶
-
IntervalArray.
repeat
(repeats, axis=None)[source]¶ Repeat elements of a IntervalArray.
Returns a new IntervalArray where each element of the current IntervalArray is repeated consecutively a given number of times.
Parameters: - repeats : int or array of ints
The number of repetitions for each element. This should be a non-negative integer. Repeating 0 times will return an empty IntervalArray.
- axis : None
Must be
None
. Has no effect but is accepted for compatibility with numpy.
Returns: - repeated_array : IntervalArray
Newly created IntervalArray with repeated elements.
See also
Series.repeat
- Equivalent function for Series.
Index.repeat
- Equivalent function for Index.
numpy.repeat
- Similar method for
numpy.ndarray
. ExtensionArray.take
- Take arbitrary positions.
Examples
>>> cat = pd.Categorical(['a', 'b', 'c']) >>> cat [a, b, c] Categories (3, object): [a, b, c] >>> cat.repeat(2) [a, a, b, b, c, c] Categories (3, object): [a, b, c] >>> cat.repeat([1, 2, 3]) [a, b, b, c, c, c] Categories (3, object): [a, b, c]