Skip to content

Commit

Permalink
DOC: Fix Numpy Docstring errors in pandas.api.extensions.ExtensionArr…
Browse files Browse the repository at this point in the history
…ay (#59605)

* fix duplicated

* fix fillna

* fix insert

* fix isin

* fix tolist

* fix unique

* fix view

---------

Co-authored-by: Abhinav Thimma <athimma2@illinois.edu>
  • Loading branch information
abhinav-thimma and athimma2 authored Aug 26, 2024
1 parent 55441d3 commit 6fa4eb4
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
7 changes: 0 additions & 7 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.tzinfo GL08" \
-i "pandas.Timestamp.value GL08" \
-i "pandas.Timestamp.year GL08" \
-i "pandas.api.extensions.ExtensionArray.duplicated RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.fillna SA01" \
-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.tolist RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.unique RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray.view SA01" \
-i "pandas.api.interchange.from_dataframe RT03,SA01" \
-i "pandas.api.types.is_bool PR01,SA01" \
-i "pandas.api.types.is_categorical_dtype SA01" \
Expand Down
52 changes: 51 additions & 1 deletion pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,13 @@ def fillna(
ExtensionArray
With NA/NaN filled.
See Also
--------
api.extensions.ExtensionArray.dropna : Return ExtensionArray without
NA values.
api.extensions.ExtensionArray.isna : A 1-D array indicating if
each value is missing.
Examples
--------
>>> arr = pd.array([np.nan, np.nan, 2, 3, np.nan, np.nan])
Expand Down Expand Up @@ -1220,6 +1227,15 @@ def duplicated(
Returns
-------
ndarray[bool]
With true in indices where elements are duplicated and false otherwise.
See Also
--------
DataFrame.duplicated : Return boolean Series denoting
duplicate rows.
Series.duplicated : Indicate duplicate Series values.
api.extensions.ExtensionArray.unique : Compute the ExtensionArray
of unique values.
Examples
--------
Expand Down Expand Up @@ -1303,6 +1319,13 @@ def unique(self) -> Self:
Returns
-------
pandas.api.extensions.ExtensionArray
With unique values from the input array.
See Also
--------
Index.unique: Return unique values in the index.
Series.unique: Return unique values of Series object.
unique: Return unique values based on a hash table.
Examples
--------
Expand Down Expand Up @@ -1436,10 +1459,18 @@ def isin(self, values: ArrayLike) -> npt.NDArray[np.bool_]:
Parameters
----------
values : np.ndarray or ExtensionArray
Values to compare every element in the array against.
Returns
-------
np.ndarray[bool]
With true at indices where value is in `values`.
See Also
--------
DataFrame.isin: Whether each element in the DataFrame is contained in values.
Index.isin: Return a boolean array where the index values are in values.
Series.isin: Whether elements in Series are contained in values.
Examples
--------
Expand Down Expand Up @@ -1743,6 +1774,12 @@ def view(self, dtype: Dtype | None = None) -> ArrayLike:
ExtensionArray or np.ndarray
A view on the :class:`ExtensionArray`'s data.
See Also
--------
api.extensions.ExtensionArray.ravel: Return a flattened view on input array.
Index.view: Equivalent function for Index.
ndarray.view: New view of array with the same data.
Examples
--------
This gives view on the underlying data of an ``ExtensionArray`` and is not a
Expand Down Expand Up @@ -2201,6 +2238,12 @@ def tolist(self) -> list:
Returns
-------
list
Python list of values in array.
See Also
--------
Index.to_list: Return a list of the values in the Index.
Series.to_list: Return a list of the values in the Series.
Examples
--------
Expand All @@ -2223,11 +2266,18 @@ def insert(self, loc: int, item) -> Self:
Parameters
----------
loc : int
Index where the `item` needs to be inserted.
item : scalar-like
Value to be inserted.
Returns
-------
same type as self
ExtensionArray
With `item` inserted at `loc`.
See Also
--------
Index.insert: Make new Index inserting new item at location.
Notes
-----
Expand Down

0 comments on commit 6fa4eb4

Please sign in to comment.