You are viewing documentation about an older version (1.22.1). View latest version

modin.pandas.unique

snowflake.snowpark.modin.pandas.general.unique(values) ndarray[source]

Return unique values based on a hash table. Unique values are returned in the order of appearance. This does NOT sort.

Parameters:

values (ndarray (1-d), list, bytearray, tuple, Series, Index, list-like) – Non-hashable objects like set, dict, and user defined classes are invalid input. Values to perform computation.

Returns:

  • ndarray

  • The unique values returned as a NumPy array. See Notes.

See also

Series.unique

Notes

Returns the unique values as a NumPy array. This includes

  • Datetime with Timezone

  • IntegerNA

See Examples section.

Examples

>>> pd.unique([2, 1, 3, 3])
array([2, 1, 3])
Copy
>>> pd.unique([pd.Timestamp('2016-01-01', tz='US/Eastern')
...            for _ in range(3)])
array([Timestamp('2016-01-01 00:00:00-0500', tz='UTC-05:00')],
      dtype=object)
Copy
>>> pd.unique([("a", "b"), ("b", "a"), ("a", "c"), ("b", "a")])
array([list(['a', 'b']), list(['b', 'a']), list(['a', 'c'])], dtype=object)
Copy
>>> pd.unique([None, np.nan, 2])
array([nan,  2.])
Copy