npy · shipping · also .npy, NPY

NumPy NPY format

NPY is NumPy's binary format for storing one array with a header describing its data type, shape and storage order.

Related Observatory article: Read on hesela.com

The numeric payload is interpreted using the header; a digest of payload bytes alone does not bind the array's shape, byte order or coordinate assignment. NPY format versions and NumPy library versions are different identifiers. [1]

Additional dtype metadata is removed during serialization by the reviewed NumPy 2.5.4 implementation, with a warning. An application-supplied unit in dtype.metadata is not a preserved NPY field. [4] [5]

Successive NPY records can share a file object, so an application must define whether it expects exactly one record or a sequence. [3]

NPY does not guarantee preservation of arbitrary ndarray subclass identity, behavior or extra attributes; the ordinary non-pickled array path reconstructs a regular ndarray. This is a documented limitation, separate from the numeric-array observations. [1]

Byte-order inspection: For plain unsigned 16-bit arrays, NumPy scalar extraction uses native byte order and does not retain the array's source order. Inspect the array dtype and payload bytes rather than treating a scalar's dtype as a record of the NPY payload representation. [6]

Relations

related
NumPy NPZ archive, Checksum, File storage, Byte order, Metadata

Limitations

  • NPY stores contiguous C- or Fortran-order array data, not an arbitrary in-memory view's strides. [1]
  • allow_pickle=False governs object-array loading, not end-to-end integrity or intended scientific meaning. [2]
  • Preserve application semantics such as units and axis identity in an explicit schema bound to the accepted data.

Citations

  1. NumPy format documentation: NPY and NPZ layout (accessed 2026-10-24)
  2. NumPy load API (accessed 2026-10-24)
  3. NumPy save API: successive array records (accessed 2026-10-24)
  4. NumPy 2.5.4 pinned format implementation (accessed 2026-10-24)
  5. NumPy drop_metadata: np.save and np.savez omit additional dtype metadata (accessed 2026-10-24)
  6. NumPy: scalar extraction and byte-swapping (accessed 2026-11-06)
Sources & caveats
  • Format/API documentation and NumPy commit a3d0ef1df045b858e68115001fdabc930bb3b68c.
  • Controlled NumPy 2.5.4 / CPython 3.12.3 observations use synthetic numeric arrays and BytesIO, not physical media, mmap or a corruption-rate sample.
  • Reproduction: https://hesela.dev/research/npy-interpretation/reproduction.zip

JSON: /data/terms/npy.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. NumPy NPY format. Hesela. 2026-11-06. https://hesela.dev/terms/npy/