# xarray.groupers.UniqueGrouper

### *class* xarray.groupers.UniqueGrouper(labels=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/groupers.py#L209-L342)

Grouper object for grouping by a categorical variable.

* **Parameters:**
  **labels** ([array-like](https://numpy.org/doc/stable/glossary.html#term-array_like), *optional*) – Group labels to aggregate on. This is required when grouping by a chunked array type
  (e.g. dask or cubed) since it is used to construct the coordinate on the output.
  Grouped operations will only be run on the specified group labels. Any group that is not
  present in `labels` will be ignored.

#### \_\_init_\_(labels=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../doc/<string>)

### Methods

| [`__init__`](#xarray.groupers.UniqueGrouper.__init__)([labels])   |                                                            |
|-----------------------------------------------------------------------|------------------------------------------------------------|
| `factorize`(group)                                                    | Creates intermediates necessary for GroupBy.               |
| `reset`()                                                             | Creates a new version of this Grouper clearing any caches. |

### Attributes

| `group_as_index`   | Caches the group DataArray as a pandas Index.   |
|--------------------|-------------------------------------------------|
| `labels`           |                                                 |
