Pandas: Data Manipulation - unique() function
unique() function
Hash table-based unique. Uniques are returned in order of appearance. This does NOT sort.
Significantly faster than numpy.unique. Includes NA values.
Syntax:
pandas.unique(values)
Parameters:
Name | Description | Type | Required / Optional |
---|---|---|---|
values | 1d array-like | Required |
Returns: numpy.ndarray or ExtensionArray
- The return can be:
- Index : when the input is an Index
- Categorical : when the input is a Categorical dtype
- ndarray : when the input is a Series/ndarray
Return numpy.ndarray or ExtensionArray.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: factorize() function
Next: wide_to_long() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/pandas/unique.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics