Skip to content

Commit ac8ba68

Browse files
DOC: Enforce Numpy Docstring Validation for pandas.Index.names (#58563)
* DOC: add GL08 for pandas.Index.names * DOC: remove GL08 for pandas.Index.names * DOC: change return type to FrozenList in example
1 parent 3156fe4 commit ac8ba68

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8282
-i "pandas.Grouper PR02" \
8383
-i "pandas.Index PR07" \
8484
-i "pandas.Index.join PR07,RT03,SA01" \
85-
-i "pandas.Index.names GL08" \
8685
-i "pandas.Index.ravel PR01,RT03" \
8786
-i "pandas.Index.str PR01,SA01" \
8887
-i "pandas.Interval PR02" \

pandas/core/indexes/base.py

+17
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,23 @@ def _get_default_index_names(
17991799
return names
18001800

18011801
def _get_names(self) -> FrozenList:
1802+
"""
1803+
Get names on index.
1804+
1805+
See Also
1806+
--------
1807+
Index.name : Return Index or MultiIndex name.
1808+
1809+
Examples
1810+
--------
1811+
>>> idx = pd.Index([1, 2, 3], name="x")
1812+
>>> idx.names
1813+
FrozenList(['x'])
1814+
1815+
>>> idx = s = pd.Index([1, 2, 3], name=("x", "y"))
1816+
>>> idx.names
1817+
FrozenList([('x', 'y')])
1818+
"""
18021819
return FrozenList((self.name,))
18031820

18041821
def _set_names(self, values, *, level=None) -> None:

0 commit comments

Comments
 (0)