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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework