Skip to content

Commit 1f68bdd

Browse files
authored
add Column.unique_indices (#151)
1 parent e6de485 commit 1f68bdd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

spec/API_specification/dataframe_api/column_object.py

+21
Original file line numberDiff line numberDiff line change
@@ -430,3 +430,24 @@ def isnan(self) -> Column:
430430
Does *not* include 'missing' or 'null' entries.
431431
In particular, does not check for `np.timedelta64('NaT')`.
432432
"""
433+
434+
def unique_indices(self, *, skip_nulls: bool = True) -> Column[int]:
435+
"""
436+
Return indices corresponding to unique values in Column.
437+
438+
Returns
439+
-------
440+
Column[int]
441+
Indices corresponding to unique values.
442+
443+
Notes
444+
-----
445+
There are no ordering guarantees. In particular, if there are multiple
446+
indices corresponding to the same unique value, there is no guarantee
447+
about which one will appear in the result.
448+
If the original Column contains multiple `'NaN'` values, then
449+
only a single index corresponding to those values should be returned.
450+
Likewise for null values (if ``skip_nulls=False``).
451+
To get the unique values, you can do ``col.get_rows(col.unique_indices())``.
452+
"""
453+
...

0 commit comments

Comments
 (0)