xarray.CFTimeIndex.repeat¶
-
CFTimeIndex.repeat(repeats, axis=None)¶ 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: repeated_index – Newly created Index with repeated elements.
Return type: Index
See also
Series.repeat()- Equivalent function for Series.
numpy.repeat()- Similar method for
numpy.ndarray.
Examples
>>> 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')