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
| 76 | |
| 77 | @set_module("pandas") |
| 78 | class RangeIndex(Index): |
| 79 | """ |
| 80 | Immutable Index implementing a monotonic integer range. |
| 81 | |
| 82 | RangeIndex is a memory-saving special case of an Index limited to representing |
| 83 | monotonic ranges with a 64-bit dtype. Using RangeIndex may in some instances |
| 84 | improve computing speed. |
| 85 | |
| 86 | This is the default index type used |
| 87 | by DataFrame and Series when no explicit index is provided by the user. |
| 88 | |
| 89 | Parameters |
| 90 | ---------- |
| 91 | start : int, range, or other RangeIndex instance, default None |
| 92 | If int and "stop" is not given, interpreted as "stop" instead. |
| 93 | stop : int, default None |
| 94 | The end value of the range (exclusive). |
| 95 | step : int, default None |
| 96 | The step size of the range. |
| 97 | dtype : np.int64, default None |
| 98 | Unused, accepted for homogeneity with other index types. |
| 99 | copy : bool, default False |
| 100 | Unused, accepted for homogeneity with other index types. |
| 101 | name : object, optional |
| 102 | Name to be stored in the index. |
| 103 | |
| 104 | Attributes |
| 105 | ---------- |
| 106 | start |
| 107 | stop |
| 108 | step |
| 109 | |
| 110 | Methods |
| 111 | ------- |
| 112 | from_range |
| 113 | |
| 114 | See Also |
| 115 | -------- |
| 116 | Index : The base pandas Index type. |
| 117 | |
| 118 | Examples |
| 119 | -------- |
| 120 | >>> list(pd.RangeIndex(5)) |
| 121 | [0, 1, 2, 3, 4] |
| 122 | |
| 123 | >>> list(pd.RangeIndex(-2, 4)) |
| 124 | [-2, -1, 0, 1, 2, 3] |
| 125 | |
| 126 | >>> list(pd.RangeIndex(0, 10, 2)) |
| 127 | [0, 2, 4, 6, 8] |
| 128 | |
| 129 | >>> list(pd.RangeIndex(2, -10, -3)) |
| 130 | [2, -1, -4, -7] |
| 131 | |
| 132 | >>> list(pd.RangeIndex(0)) |
| 133 | [] |
| 134 | |
| 135 | >>> list(pd.RangeIndex(1, 0)) |
no outgoing calls