A sorted dictionary with nearest-key lookup
Project description
fuzzysorteddict is a sorted dictionary with nearest-key lookups.
>>> from fuzzysorteddict import FuzzySortedDict >>> d = FuzzySortedDict() >>> d[1] = 1 >>> d[2] = 2 >>> d[1.75] 2
FuzzySortedDict can be particularly useful for sparsely populated ranges, such as when working with time.
>>> from fuzzysorteddict import FuzzySortedDict >>> import datetime >>> d = FuzzySortedDict() >>> d[datetime.datetime(2000, 1, 1, 12, 0, 0)] = 1 >>> d[datetime.datetime(2000, 1, 1, 12, 0, 4)] = 2 >>> d[datetime.datetime(2000, 1, 1, 12, 0, 1)] 1
Installation
FuzzySortedDict is easily installed with pip.
pip install fuzzysorteddict
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fuzzysorteddict-1.1.0.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for fuzzysorteddict-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7361c322e44bd65c5f37a064642b0b7b6dbc4ecd76c09ff7951b6fef650de765 |
|
MD5 | fb55c53a04bd1ea5180b60501c4d10b6 |
|
BLAKE2b-256 | 1c6b3ac59681233dfb95dc86ccbea5e4d81ef0b6b6a7e8c69f3c53a56194bdae |