Skip to main content

unik

Provide functionality for working with selections of unique items in lists / arrays

Installation

You can install unik using pip:

pip install unik

Usage

>>> import numpy as np
>>> from unik import Unique

>>> items = [1, 2, 2, 2, 3, 1, 4, 3]
>>> un = Unique(items, verbose=True)
   N  value     
====  ==========
   2           1
   3           2
   2           3
   1           4
  
>>> print(un.info(sort_counts=True))
   N  value     
====  ==========
   1           4
   2           1
   2           3
   3           2

>>> items = np.array(['apples', 'apples', 'oranges', 'apples', 'grapes'])
>>> un = Unique(items, verbose=True)
   N  value     
====  ==========
   3  apples    
   1  grapes    
   1  oranges   

>>> print(np.array(un.values)[un.counts > 1])
['apples']

>>> another_array = np.array(['tree', 'tree', 'tree', 'tree', 'vine'])
>>> for i in un.unique_index():
>>>     print(f'{items[i]} grow on a {another_array[i]}')
apples grow on a tree
grapes grow on a vine
oranges grow on a tree

# __get__ builtin returns boolean array
>>> print(un['apples'])
[ True  True False  True False]

>>> print(items[~un['apples']])
['oranges' 'grapes']

>>> print(another_array[~un['apples']])
['tree' 'vine']

License

MIT License - see LICENSE file for details

Metadata

Release files for unik 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unik 1.0
File Size Uploaded
unik-1.0.tar.gz 9.6 kB Details

Release files / unik-1.0.tar.gz

Download URL unik-1.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9252393f820494a0fe1cfb2d3a37fa1b5bc47ff6b2f11e89fd9bc574b12f0520
BLAKE2b-256 checksum
How to use checksums
16392c7917060e5c426773975659fcc7cecea0f3e6b717e71e396e0bf5a699ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

0.2.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page