NDArray with both-side insertion/deletion and size limit
Project description
Introduction
Wrap numpy.ndarray
to support fast both-side insertion/deletion and size limit.
- Fully typed.
- Directly perform arithmetic operations with NDArray
- pickleable
- JSON serializable
Both-side insertion/deletion
arr = ArrayBuffer()
arr.extend(np.arange(100))
arr.append(100)
arr.appendleft(0)
arr.pop(1)
arr.popleft(1)
Size limit
arr = ArrayBuffer(max_len=10)
arr.extend(np.arange(10))
assert len(arr) == 10
assert np.array_equal(arr, np.arange(10))
arr.append(10)
assert len(arr) == 10
assert np.array_equal(arr, np.arange(1, 11))
JSON Serialization and Deserialization
arr = ArrayBuffer(max_len=10, dtype=np.float64)
arr.extend(np.arange(10))
state_dict = arr.state_dict()
rec = ArrayBuffer.load(json.loads(json.dumps(state_dict)))
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
ndarraybuffer-0.1.0.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for ndarraybuffer-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07ff9133b8c395cd56ce4201cfdd0efed7554251cb0826c8d8aedacd6fcf373b |
|
MD5 | b94ade6c9053c38abdf8611489521ed1 |
|
BLAKE2b-256 | 40d1c25e9acf718d50de8e279dc2d631fb8af93a40eeaed3d2eb3a36326f5f94 |