Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: fixing SA01 errors for index.size, shape, and ndim. #58333

Merged
merged 4 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,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 @@ -357,7 +354,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 @@ -377,7 +373,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