pandas.RangeIndex.from_range

pandas 3.1.1 · Index objects · method

Build a compact RangeIndex from the start, stop and step of a Python range.

Call syntax

RangeIndex.from_range(data, name=None, dtype=None)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
data Required
Positional or keyword
range

Provide the input data read, transformed, or stored by this call.

name Optional
Positional or keyword
Default None
str

Set a name or identify the named object used by the operation.

dtype Optional
Positional or keyword
Default None
Dtype or None

Choose the data type for the input conversion or result.

Returns

RangeIndex