Skip to content

Commit 32abfe2

Browse files
authored
DOC: update np.unique docstring (numpy#27238)
* update `np.uniqe` docstring * address comment * move explanation to Notes and add np.sort to See Also
1 parent 7565e25 commit 32abfe2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

numpy/lib/_arraysetops_impl.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def unique(ar, return_index=False, return_inverse=False,
203203
See Also
204204
--------
205205
repeat : Repeat elements of an array.
206+
sort : Return a sorted copy of an array.
206207
207208
Notes
208209
-----
@@ -216,17 +217,15 @@ def unique(ar, return_index=False, return_inverse=False,
216217
flattened subarrays are sorted in lexicographic order starting with the
217218
first element.
218219
219-
.. versionchanged: 1.21
220-
If nan values are in the input array, a single nan is put
221-
to the end of the sorted unique values.
222-
223-
Also for complex arrays all NaN values are considered equivalent
220+
.. versionchanged:: 1.21
221+
Like np.sort, NaN will sort to the end of the values.
222+
For complex arrays all NaN values are considered equivalent
224223
(no matter whether the NaN is in the real or imaginary part).
225224
As the representant for the returned array the smallest one in the
226225
lexicographical order is chosen - see np.sort for how the lexicographical
227226
order is defined for complex arrays.
228227
229-
.. versionchanged: 2.0
228+
.. versionchanged:: 2.0
230229
For multi-dimensional inputs, ``unique_inverse`` is reshaped
231230
such that the input can be reconstructed using
232231
``np.take(unique, unique_inverse, axis=axis)``. The result is

0 commit comments

Comments
 (0)