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
pip install ndarraybuffer
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
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.3.tar.gz
(3.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ndarraybuffer-0.1.3.tar.gz.
File metadata
- Download URL: ndarraybuffer-0.1.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4b4696969fe69bfa7a0c9fbb896b2c331d221e610ee992fcf3563cdddeecbdc
|
|
| MD5 |
ca6dc81d5594913c135dbc6bcc6dff7f
|
|
| BLAKE2b-256 |
d1db1e59bf1e1578cbf04d2523d1e75c6c44e18313f6c2cc6cf2cf3f96635e35
|
File details
Details for the file ndarraybuffer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ndarraybuffer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8192fbd9c34fd3e5eec708b4b8c34f6639dce7320ea5ab9e686f1f4dfb226d8
|
|
| MD5 |
78222246ae372a2c177e88342eb66a6f
|
|
| BLAKE2b-256 |
828dc27d48d3ee95a61ddc2aab8291156f8b3463dc9aa822266dbc6bd9b40e93
|