Skip to content

Commit

Permalink
DOC: fix PR01,SA01,ES01 for pandas.RangeIndex.from_range (#60720)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhinsharma121 authored Jan 16, 2025
1 parent 5c9b671 commit a15a4b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
-i "pandas.Period.freq GL08" \
-i "pandas.Period.ordinal GL08" \
-i "pandas.RangeIndex.from_range PR01,SA01" \
-i "pandas.Timedelta.max PR02" \
-i "pandas.Timedelta.min PR02" \
-i "pandas.Timedelta.resolution PR02" \
Expand Down
21 changes: 21 additions & 0 deletions pandas/core/indexes/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,31 @@ def from_range(cls, data: range, name=None, dtype: Dtype | None = None) -> Self:
"""
Create :class:`pandas.RangeIndex` from a ``range`` object.
This method provides a way to create a :class:`pandas.RangeIndex` directly
from a Python ``range`` object. The resulting :class:`RangeIndex` will have
the same start, stop, and step values as the input ``range`` object.
It is particularly useful for constructing indices in an efficient and
memory-friendly manner.
Parameters
----------
data : range
The range object to be converted into a RangeIndex.
name : str, default None
Name to be stored in the index.
dtype : Dtype or None
Data type for the RangeIndex. If None, the default integer type will
be used.
Returns
-------
RangeIndex
See Also
--------
RangeIndex : Immutable Index implementing a monotonic integer range.
Index : Immutable sequence used for indexing and alignment.
Examples
--------
>>> pd.RangeIndex.from_range(range(5))
Expand Down

0 comments on commit a15a4b5

Please sign in to comment.