Skip to content

Commit be9e5fe

Browse files
evensongAryn1102
authored andcommitted
DOC Replace @doc decorator with inline docstring in core/arrays/sparse/array.py (pandas-dev#63941)
1 parent 9c55a62 commit be9e5fe

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

pandas/core/arrays/sparse/array.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from pandas.compat.numpy import function as nv
3333
from pandas.errors import PerformanceWarning
3434
from pandas.util._decorators import (
35-
doc,
3635
set_module,
3736
)
3837
from pandas.util._exceptions import find_stack_level
@@ -885,10 +884,38 @@ def _first_fill_value_loc(self):
885884
diff = np.r_[np.diff(indices), 2]
886885
return indices[(diff > 1).argmax()] + 1
887886

888-
@doc(ExtensionArray.duplicated)
889887
def duplicated(
890888
self, keep: Literal["first", "last", False] = "first"
891889
) -> npt.NDArray[np.bool_]:
890+
"""
891+
Return boolean ndarray denoting duplicate values.
892+
893+
Parameters
894+
----------
895+
keep : {'first', 'last', False}, default 'first'
896+
- ``first`` : Mark duplicates as ``True`` except for the first occurrence.
897+
- ``last`` : Mark duplicates as ``True`` except for the last occurrence.
898+
- False : Mark all duplicates as ``True``.
899+
900+
Returns
901+
-------
902+
ndarray[bool]
903+
With true in indices where elements are duplicated and false otherwise.
904+
905+
See Also
906+
--------
907+
DataFrame.duplicated : Return boolean Series denoting
908+
duplicate rows.
909+
Series.duplicated : Indicate duplicate Series values.
910+
api.extensions.ExtensionArray.unique : Compute the ExtensionArray
911+
of unique values.
912+
913+
Examples
914+
--------
915+
>>> pd.array([1, 1, 2, 3, 3], dtype=pd.SparseDtype(np.int64)).duplicated()
916+
array([False, True, False, False, True])
917+
"""
918+
892919
values = np.asarray(self)
893920
mask = np.asarray(self.isna())
894921
return algos.duplicated(values, keep=keep, mask=mask)

0 commit comments

Comments
 (0)