To display the value of the start parameter of RangeIndex, use the index.start property in Pandas. At first, import the required libraries −
import pandas as pd
RangeIndex is a memory-saving special case of Int64Index limited to representing monotonic ranges. Using RangeIndex may in some instances improve computing speed. Create a range index with start, stop and step. The name is the name to be stored in the index.
index = pd.RangeIndex(start=5, stop=20, step=2, name="data")
Display the RangeIndex −
print("RangeIndex...\n",index)
Display the start parameter value −
print("\nRangeIndex start value...\n",index.start)
Example
Following is the code −
import pandas as pd # Create a range index with start, stop and step # The name is the name to be stored in the index. index = pd.RangeIndex(start=5, stop=20, step=2, name="data") # Display the RangeIndex print("RangeIndex...\n",index) # Display the start parameter value print("\nRangeIndex start value...\n",index.start)
Output
This will produce the following output −
RangeIndex... RangeIndex(start=5, stop=20, step=2, name='data') RangeIndex start value... 5