NISHIO Hirokazu[Translate]
numpy.unique
python
>>> set(np.int64("1 2 3 1 4 2 0".split())) {0, 1, 2, 3, 4} >>> np.unique(np.int64("1 2 3 1 4 2 0".split())) array([0, 1, 2, 3, 4])
setがハッシュテーブルであるのに対し、こちらはソート済みのnp.arrayである

>This function uses the same algorithm as the builtin python bisect.bisect_left (side='left') and bisect.bisect_right (side='right') functions, which is also vectorized in the v argument.


"Engineer's way of creating knowledge" the English version of my book is now available on [Engineer's way of creating knowledge]

(C)NISHIO Hirokazu / Converted from [Scrapbox] at [Edit]