Skip to content

Commit a15a4b5

Browse files
DOC: fix PR01,SA01,ES01 for pandas.RangeIndex.from_range (#60720)
1 parent 5c9b671 commit a15a4b5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7272
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
7373
-i "pandas.Period.freq GL08" \
7474
-i "pandas.Period.ordinal GL08" \
75-
-i "pandas.RangeIndex.from_range PR01,SA01" \
7675
-i "pandas.Timedelta.max PR02" \
7776
-i "pandas.Timedelta.min PR02" \
7877
-i "pandas.Timedelta.resolution PR02" \

pandas/core/indexes/range.py

+21
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,31 @@ def from_range(cls, data: range, name=None, dtype: Dtype | None = None) -> Self:
190190
"""
191191
Create :class:`pandas.RangeIndex` from a ``range`` object.
192192
193+
This method provides a way to create a :class:`pandas.RangeIndex` directly
194+
from a Python ``range`` object. The resulting :class:`RangeIndex` will have
195+
the same start, stop, and step values as the input ``range`` object.
196+
It is particularly useful for constructing indices in an efficient and
197+
memory-friendly manner.
198+
199+
Parameters
200+
----------
201+
data : range
202+
The range object to be converted into a RangeIndex.
203+
name : str, default None
204+
Name to be stored in the index.
205+
dtype : Dtype or None
206+
Data type for the RangeIndex. If None, the default integer type will
207+
be used.
208+
193209
Returns
194210
-------
195211
RangeIndex
196212
213+
See Also
214+
--------
215+
RangeIndex : Immutable Index implementing a monotonic integer range.
216+
Index : Immutable sequence used for indexing and alignment.
217+
197218
Examples
198219
--------
199220
>>> pd.RangeIndex.from_range(range(5))

0 commit comments

Comments
 (0)