Skip to main content

NDArray with both-side insertion/deletion and size limit

Project description

Coverage badge

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.2.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ndarraybuffer-0.2.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file ndarraybuffer-0.2.1.tar.gz.

File metadata

  • Download URL: ndarraybuffer-0.2.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.6 Darwin/24.0.0

File hashes

Hashes for ndarraybuffer-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d6d9945767b60da946469312283c1d6ea1fb595d7d086aac87a05cea7127fb70
MD5 394a9276bd34b47caeb4e0be8d1588d6
BLAKE2b-256 b3bcc8cfd02aa3d3bd406d74fc09b3743b8bcdbf58c4f6b6bad0546718628e9f

See more details on using hashes here.

File details

Details for the file ndarraybuffer-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ndarraybuffer-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.6 Darwin/24.0.0

File hashes

Hashes for ndarraybuffer-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f505a1e40a708c3776cf5527f7a32ec647d5d3346cab81d90f7c58263b04a2e3
MD5 527869a5a04de5c6fcb2feeced204f1f
BLAKE2b-256 466b44d5ef87d87b3c90fa6d240a7e75d2a7a939bd2ee62cbc1ed5d0f688e59d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page