Skip to content

Commit

Permalink
DOC: fixing SA01 errors for index.size, shape, and ndim. (#58333)
Browse files Browse the repository at this point in the history
* Doc: fixing SA01 for index.size, shape, and ndim

* EXPECTED TO FAIL, BUT NOT FAILING

* changing from Index to Series for core/basy.py
  • Loading branch information
KeiOshima committed Apr 20, 2024
1 parent 9f7e89e commit 7cafc21
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
5 changes: 0 additions & 5 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,10 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Index.name SA01" \
-i "pandas.Index.names GL08" \
-i "pandas.Index.nbytes SA01" \
-i "pandas.Index.ndim SA01" \
-i "pandas.Index.nunique RT03" \
-i "pandas.Index.putmask PR01,RT03" \
-i "pandas.Index.ravel PR01,RT03" \
-i "pandas.Index.reindex PR07" \
-i "pandas.Index.shape SA01" \
-i "pandas.Index.size SA01" \
-i "pandas.Index.slice_indexer PR07,RT03,SA01" \
-i "pandas.Index.slice_locs RT03" \
-i "pandas.Index.str PR01,SA01" \
Expand Down Expand Up @@ -356,7 +353,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.mode SA01" \
-i "pandas.Series.mul PR07" \
-i "pandas.Series.nbytes SA01" \
-i "pandas.Series.ndim SA01" \
-i "pandas.Series.ne PR07,SA01" \
-i "pandas.Series.nunique RT03" \
-i "pandas.Series.pad PR01,SA01" \
Expand All @@ -376,7 +372,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.rtruediv PR07" \
-i "pandas.Series.sem PR01,RT03,SA01" \
-i "pandas.Series.shape SA01" \
-i "pandas.Series.size SA01" \
-i "pandas.Series.skew RT03,SA01" \
-i "pandas.Series.sparse PR01,SA01" \
-i "pandas.Series.sparse.density SA01" \
Expand Down
14 changes: 14 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ def ndim(self) -> Literal[1]:
"""
Number of dimensions of the underlying data, by definition 1.
See Also
--------
Series.size: Return the number of elements in the underlying data.
Series.shape: Return a tuple of the shape of the underlying data.
Series.dtype: Return the dtype object of the underlying data.
Series.values: Return Series as ndarray or ndarray-like depending on the dtype.
Examples
--------
>>> s = pd.Series(["Ant", "Bear", "Cow"])
Expand Down Expand Up @@ -440,6 +447,13 @@ def size(self) -> int:
"""
Return the number of elements in the underlying data.
See Also
--------
Series.ndim: Number of dimensions of the underlying data, by definition 1.
Series.shape: Return a tuple of the shape of the underlying data.
Series.dtype: Return the dtype object of the underlying data.
Series.values: Return Series as ndarray or ndarray-like depending on the dtype.
Examples
--------
For Series:
Expand Down
7 changes: 7 additions & 0 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7104,6 +7104,13 @@ def shape(self) -> Shape:
"""
Return a tuple of the shape of the underlying data.
See Also
--------
Index.size: Return the number of elements in the underlying data.
Index.ndim: Number of dimensions of the underlying data, by definition 1.
Index.dtype: Return the dtype object of the underlying data.
Index.values: Return an array representing the data in the Index.
Examples
--------
>>> idx = pd.Index([1, 2, 3])
Expand Down

0 comments on commit 7cafc21

Please sign in to comment.