dfr unique for [dataframe or lazyframe](/commands/categories/dataframe or lazyframe.md)

Returns unique values from a dataframe.

WARNING

Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe flag

Signature

> dfr unique {flags}

Flags

  • --subset, -s {any}: Subset of column(s) to use to maintain rows (lazy df)
  • --last, -l: Keeps last unique value. Default keeps first value (lazy df)
  • --maintain-order, -k: Keep the same order as the original DataFrame (lazy df)

Input/output types:

inputoutput
anyany

Examples

Returns unique values from a series

> [2 2 2 2 2] | dfr into-df | dfr unique
╭───┬───╮
 # │ 0 │
├───┼───┤
 0 2
╰───┴───╯

Creates a is unique expression from a column

> col a | unique