@@ -696,12 +696,38 @@ def memory_usage(self, deep=False):
696696 @deprecate_kwarg (old_arg_name = 'n' , new_arg_name = 'repeats' )
697697 def repeat (self , repeats , * args , ** kwargs ):
698698 """
699- Repeat elements of an Index. Refer to `numpy.ndarray.repeat`
700- for more information about the `repeats` argument.
699+ Repeat elements of an Index.
701700
702- See also
701+ Returns a new index where each element of the current index
702+ is repeated consecutively a given number of times.
703+
704+ Parameters
705+ ----------
706+ repeats : int
707+ The number of repetitions for each element.
708+ **kwargs
709+ Additional keywords have no effect but might be accepted for
710+ compatibility with numpy.
711+
712+ Returns
713+ -------
714+ pandas.Index
715+ Newly created Index with repeated elements.
716+
717+ See Also
718+ --------
719+ Series.repeat : Equivalent function for Series
720+ numpy.repeat : Underlying implementation
721+
722+ Examples
703723 --------
704- numpy.ndarray.repeat
724+ >>> idx = pd.Index([1, 2, 3])
725+ >>> idx
726+ Int64Index([1, 2, 3], dtype='int64')
727+ >>> idx.repeat(2)
728+ Int64Index([1, 1, 2, 2, 3, 3], dtype='int64')
729+ >>> idx.repeat(3)
730+ Int64Index([1, 1, 1, 2, 2, 2, 3, 3, 3], dtype='int64')
705731 """
706732 nv .validate_repeat (args , kwargs )
707733 return self ._shallow_copy (self ._values .repeat (repeats ))
0 commit comments