Skip to content

Commit

Permalink
DOC: Fix Numpy Docstring validation errors in pandas.api.extensions.E…
Browse files Browse the repository at this point in the history
…xtensionArray (#59540)

* Fix SA01 for isna

* Fix See Also for nbytes

* fix See also for ndim

* Fix ravel

* fis return value of take

* remove type ignore

---------

Co-authored-by: Abhinav Thimma <athimma2@illinois.edu>
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 19, 2024
1 parent ca2b8c3 commit 64aa9be
Show file tree
Hide file tree
Showing 2 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 @@ -224,11 +224,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.api.extensions.ExtensionArray.insert PR07,RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.interpolate PR01,SA01" \
-i "pandas.api.extensions.ExtensionArray.isin PR07,RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.isna SA01" \
-i "pandas.api.extensions.ExtensionArray.nbytes SA01" \
-i "pandas.api.extensions.ExtensionArray.ndim SA01" \
-i "pandas.api.extensions.ExtensionArray.ravel RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.take RT03" \
-i "pandas.api.extensions.ExtensionArray.tolist RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.unique RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.view SA01" \
Expand Down
21 changes: 21 additions & 0 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ def ndim(self) -> int:
"""
Extension Arrays are only allowed to be 1-dimensional.
See Also
--------
ExtensionArray.shape: Return a tuple of the array dimensions.
ExtensionArray.size: The number of elements in the array.
Examples
--------
>>> arr = pd.array([1, 2, 3])
Expand All @@ -662,6 +667,11 @@ def nbytes(self) -> int:
"""
The number of bytes needed to store this object in memory.
See Also
--------
ExtensionArray.shape: Return a tuple of the array dimensions.
ExtensionArray.size: The number of elements in the array.
Examples
--------
>>> pd.array([1, 2, 3]).nbytes
Expand Down Expand Up @@ -767,6 +777,11 @@ def isna(self) -> np.ndarray | ExtensionArraySupportsAnyAll:
an ndarray would be expensive, an ExtensionArray may be
returned.
See Also
--------
ExtensionArray.dropna: Return ExtensionArray without NA values.
ExtensionArray.fillna: Fill NA/NaN values using the specified method.
Notes
-----
If returning an ExtensionArray, then
Expand Down Expand Up @@ -1580,6 +1595,7 @@ def take(
Returns
-------
ExtensionArray
An array formed with selected `indices`.
Raises
------
Expand Down Expand Up @@ -1832,6 +1848,11 @@ def ravel(self, order: Literal["C", "F", "A", "K"] | None = "C") -> Self:
Returns
-------
ExtensionArray
A flattened view on the array.
See Also
--------
ExtensionArray.tolist: Return a list of the values.
Notes
-----
Expand Down

0 comments on commit 64aa9be

Please sign in to comment.