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: Fix Numpy Docstring errors in pandas.api.extensions.ExtensionArray #59605

Merged
merged 7 commits into from
Aug 26, 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
7 changes: 0 additions & 7 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,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