Immutable Index implementing a monotonic integer range.
RangeIndex is a memory-saving special case of an Index limited to representing monotonic ranges with a 64-bit dtype. Using RangeIndex may in some instances improve computing speed.
This is the default index type used by DataFrame and Series when no explicit index is provided by the user.
If int and “stop” is not given, interpreted as “stop” instead.
Unused, accepted for homogeneity with other index types.
Unused, accepted for homogeneity with other index types.
Name to be stored in the index.
Attributes
The value of the start parameter ( | |
The value of the stop parameter. | |
The value of the step parameter ( |
Methods
| Create |
See also
IndexThe base pandas Index type.
Examples
>>> list(pd.RangeIndex(5))
[0, 1, 2, 3, 4]
>>> list(pd.RangeIndex(-2, 4))
[-2, -1, 0, 1, 2, 3]
>>> list(pd.RangeIndex(0, 10, 2))
[0, 2, 4, 6, 8]
>>> list(pd.RangeIndex(2, -10, -3))
[2, -1, -4, -7]
>>> list(pd.RangeIndex(0))
[]
>>> list(pd.RangeIndex(1, 0))
[]
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.RangeIndex.html