Skip to content

Commit 7cafc21

Browse files
authored
DOC: fixing SA01 errors for index.size, shape, and ndim. (pandas-dev#58333)
* Doc: fixing SA01 for index.size, shape, and ndim * EXPECTED TO FAIL, BUT NOT FAILING * changing from Index to Series for core/basy.py
1 parent 9f7e89e commit 7cafc21

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

ci/code_checks.sh

-5
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,10 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
173173
-i "pandas.Index.name SA01" \
174174
-i "pandas.Index.names GL08" \
175175
-i "pandas.Index.nbytes SA01" \
176-
-i "pandas.Index.ndim SA01" \
177176
-i "pandas.Index.nunique RT03" \
178177
-i "pandas.Index.putmask PR01,RT03" \
179178
-i "pandas.Index.ravel PR01,RT03" \
180179
-i "pandas.Index.reindex PR07" \
181-
-i "pandas.Index.shape SA01" \
182-
-i "pandas.Index.size SA01" \
183180
-i "pandas.Index.slice_indexer PR07,RT03,SA01" \
184181
-i "pandas.Index.slice_locs RT03" \
185182
-i "pandas.Index.str PR01,SA01" \
@@ -356,7 +353,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
356353
-i "pandas.Series.mode SA01" \
357354
-i "pandas.Series.mul PR07" \
358355
-i "pandas.Series.nbytes SA01" \
359-
-i "pandas.Series.ndim SA01" \
360356
-i "pandas.Series.ne PR07,SA01" \
361357
-i "pandas.Series.nunique RT03" \
362358
-i "pandas.Series.pad PR01,SA01" \
@@ -376,7 +372,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
376372
-i "pandas.Series.rtruediv PR07" \
377373
-i "pandas.Series.sem PR01,RT03,SA01" \
378374
-i "pandas.Series.shape SA01" \
379-
-i "pandas.Series.size SA01" \
380375
-i "pandas.Series.skew RT03,SA01" \
381376
-i "pandas.Series.sparse PR01,SA01" \
382377
-i "pandas.Series.sparse.density SA01" \

pandas/core/base.py

+14
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,13 @@ def ndim(self) -> Literal[1]:
355355
"""
356356
Number of dimensions of the underlying data, by definition 1.
357357
358+
See Also
359+
--------
360+
Series.size: Return the number of elements in the underlying data.
361+
Series.shape: Return a tuple of the shape of the underlying data.
362+
Series.dtype: Return the dtype object of the underlying data.
363+
Series.values: Return Series as ndarray or ndarray-like depending on the dtype.
364+
358365
Examples
359366
--------
360367
>>> s = pd.Series(["Ant", "Bear", "Cow"])
@@ -440,6 +447,13 @@ def size(self) -> int:
440447
"""
441448
Return the number of elements in the underlying data.
442449
450+
See Also
451+
--------
452+
Series.ndim: Number of dimensions of the underlying data, by definition 1.
453+
Series.shape: Return a tuple of the shape of the underlying data.
454+
Series.dtype: Return the dtype object of the underlying data.
455+
Series.values: Return Series as ndarray or ndarray-like depending on the dtype.
456+
443457
Examples
444458
--------
445459
For Series:

pandas/core/indexes/base.py

+7
Original file line numberDiff line numberDiff line change
@@ -7104,6 +7104,13 @@ def shape(self) -> Shape:
71047104
"""
71057105
Return a tuple of the shape of the underlying data.
71067106
7107+
See Also
7108+
--------
7109+
Index.size: Return the number of elements in the underlying data.
7110+
Index.ndim: Number of dimensions of the underlying data, by definition 1.
7111+
Index.dtype: Return the dtype object of the underlying data.
7112+
Index.values: Return an array representing the data in the Index.
7113+
71077114
Examples
71087115
--------
71097116
>>> idx = pd.Index([1, 2, 3])

0 commit comments

Comments
 (0)