Skip to main content
`Ctrl`+`K`

# pandas.RangeIndex

class pandas.RangeIndex(start=None, stop=None, step=None, dtype=None, copy=False, name=None)

  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.

  Parameters:
    start int, range, or other RangeIndex instance, default None

      If int and “stop” is not given, interpreted as “stop” instead.

    stop int, default None

      The end value of the range (exclusive).

    step int, default None

      The step size of the range.

    dtype np.int64, default None

      Unused, accepted for homogeneity with other index types.

    copy bool, default False

      Unused, accepted for homogeneity with other index types.

    name object, optional

      Name to be stored in the index.

  Attributes

  `start` | The value of the start parameter (`0` if this was not supplied).
  `stop` | The value of the stop parameter.
  `step` | The value of the step parameter (`1` if this was not supplied).

  Methods

  `from_range`(data[, name, dtype]) | Create `pandas.RangeIndex` from a `range` object.

  See also

  `Index`

    The 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))
      []