Skip to content

Commit 6fa4eb4

Browse files
DOC: Fix Numpy Docstring errors in pandas.api.extensions.ExtensionArray (#59605)
* fix duplicated * fix fillna * fix insert * fix isin * fix tolist * fix unique * fix view --------- Co-authored-by: Abhinav Thimma <[email protected]>
1 parent 55441d3 commit 6fa4eb4

File tree

2 files changed

+51
-8
lines changed

2 files changed

+51
-8
lines changed

ci/code_checks.sh

-7
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
173173
-i "pandas.Timestamp.tzinfo GL08" \
174174
-i "pandas.Timestamp.value GL08" \
175175
-i "pandas.Timestamp.year GL08" \
176-
-i "pandas.api.extensions.ExtensionArray.duplicated RT03,SA01" \
177-
-i "pandas.api.extensions.ExtensionArray.fillna SA01" \
178-
-i "pandas.api.extensions.ExtensionArray.insert PR07,RT03,SA01" \
179176
-i "pandas.api.extensions.ExtensionArray.interpolate PR01,SA01" \
180-
-i "pandas.api.extensions.ExtensionArray.isin PR07,RT03,SA01" \
181-
-i "pandas.api.extensions.ExtensionArray.tolist RT03,SA01" \
182-
-i "pandas.api.extensions.ExtensionArray.unique RT03,SA01" \
183-
-i "pandas.api.extensions.ExtensionArray.view SA01" \
184177
-i "pandas.api.interchange.from_dataframe RT03,SA01" \
185178
-i "pandas.api.types.is_bool PR01,SA01" \
186179
-i "pandas.api.types.is_categorical_dtype SA01" \

pandas/core/arrays/base.py

+51-1
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,13 @@ def fillna(
11371137
ExtensionArray
11381138
With NA/NaN filled.
11391139
1140+
See Also
1141+
--------
1142+
api.extensions.ExtensionArray.dropna : Return ExtensionArray without
1143+
NA values.
1144+
api.extensions.ExtensionArray.isna : A 1-D array indicating if
1145+
each value is missing.
1146+
11401147
Examples
11411148
--------
11421149
>>> arr = pd.array([np.nan, np.nan, 2, 3, np.nan, np.nan])
@@ -1220,6 +1227,15 @@ def duplicated(
12201227
Returns
12211228
-------
12221229
ndarray[bool]
1230+
With true in indices where elements are duplicated and false otherwise.
1231+
1232+
See Also
1233+
--------
1234+
DataFrame.duplicated : Return boolean Series denoting
1235+
duplicate rows.
1236+
Series.duplicated : Indicate duplicate Series values.
1237+
api.extensions.ExtensionArray.unique : Compute the ExtensionArray
1238+
of unique values.
12231239
12241240
Examples
12251241
--------
@@ -1303,6 +1319,13 @@ def unique(self) -> Self:
13031319
Returns
13041320
-------
13051321
pandas.api.extensions.ExtensionArray
1322+
With unique values from the input array.
1323+
1324+
See Also
1325+
--------
1326+
Index.unique: Return unique values in the index.
1327+
Series.unique: Return unique values of Series object.
1328+
unique: Return unique values based on a hash table.
13061329
13071330
Examples
13081331
--------
@@ -1436,10 +1459,18 @@ def isin(self, values: ArrayLike) -> npt.NDArray[np.bool_]:
14361459
Parameters
14371460
----------
14381461
values : np.ndarray or ExtensionArray
1462+
Values to compare every element in the array against.
14391463
14401464
Returns
14411465
-------
14421466
np.ndarray[bool]
1467+
With true at indices where value is in `values`.
1468+
1469+
See Also
1470+
--------
1471+
DataFrame.isin: Whether each element in the DataFrame is contained in values.
1472+
Index.isin: Return a boolean array where the index values are in values.
1473+
Series.isin: Whether elements in Series are contained in values.
14431474
14441475
Examples
14451476
--------
@@ -1743,6 +1774,12 @@ def view(self, dtype: Dtype | None = None) -> ArrayLike:
17431774
ExtensionArray or np.ndarray
17441775
A view on the :class:`ExtensionArray`'s data.
17451776
1777+
See Also
1778+
--------
1779+
api.extensions.ExtensionArray.ravel: Return a flattened view on input array.
1780+
Index.view: Equivalent function for Index.
1781+
ndarray.view: New view of array with the same data.
1782+
17461783
Examples
17471784
--------
17481785
This gives view on the underlying data of an ``ExtensionArray`` and is not a
@@ -2201,6 +2238,12 @@ def tolist(self) -> list:
22012238
Returns
22022239
-------
22032240
list
2241+
Python list of values in array.
2242+
2243+
See Also
2244+
--------
2245+
Index.to_list: Return a list of the values in the Index.
2246+
Series.to_list: Return a list of the values in the Series.
22042247
22052248
Examples
22062249
--------
@@ -2223,11 +2266,18 @@ def insert(self, loc: int, item) -> Self:
22232266
Parameters
22242267
----------
22252268
loc : int
2269+
Index where the `item` needs to be inserted.
22262270
item : scalar-like
2271+
Value to be inserted.
22272272
22282273
Returns
22292274
-------
2230-
same type as self
2275+
ExtensionArray
2276+
With `item` inserted at `loc`.
2277+
2278+
See Also
2279+
--------
2280+
Index.insert: Make new Index inserting new item at location.
22312281
22322282
Notes
22332283
-----

0 commit comments

Comments
 (0)