RangeIndex¶
Index that is roughly equivalent to numpy.arange().
Parameters¶
- startint
Beginning position.
- stopint
End position.
- stepint
How much to increase the range every step. Must be positive.
Examples¶
>>> idx = RangeIndex(0, 10, 2)
>>> idx.keys_
array([0, 2, 4, 6, 8])
>>> idx.size
10
- Sloth.RangeIndex.get_item()¶
Retrieves an item based on its index.
- Parameters:
- argint
The item to retrieve.
- Returns:
- int
The index of the item.
- Raises:
- KeyError
If the item is not in the slice.
Examples
>>> idx = RangeIndex(0, 10, 2) >>> idx.get_item(4) 2 >>> idx.get_item(5) KeyError: '5 not in slice'
- Sloth.RangeIndex.to_pandas()¶
Converts the RangeIndex to a pandas Index object.
- Returns:
- pd.RangeIndex
A pandas RangeIndex object.
Examples
>>> idx = RangeIndex(0, 10, 2) >>> idx.to_pandas() RangeIndex(start=0, stop=10, step=2)