pyarrow.compute.count_distinct(array, *, memory_pool=None, options=None, mode='only_valid')

Count the number of unique values.

By default, only non-null values are counted. This can be changed through CountOptions.

  • array (Array-like) – Argument to compute function

  • memory_pool (pyarrow.MemoryPool, optional) – If not passed, will allocate memory from the default memory pool.

  • options (pyarrow.compute.CountOptions, optional) – Parameters altering compute function semantics.

  • mode (optional) – Parameter for CountOptions constructor. Either options or mode can be passed, but not both at the same time.