Skip to main content

Module npy

Module npy 

Source
Expand description

NumPy .npy arrays (format versions 1.0, 2.0 and 3.0).

A .npy file is the magic string \x93NUMPY, a version, a little-endian header length and a Python-literal header dictionary (descr, fortran_order, shape), padded so the data starts on a 64-byte boundary, followed by the raw array data. Reading supports booleans, signed and unsigned integers of 1 to 8 bytes, 16-, 32- and 64-bit floats (half precision is widened to single) and 64- and 128-bit complex numbers, in either byte order and in C or Fortran order; data are returned in C (row-major) order. Writing produces version 1.0 C-order little-endian files.

See the book entry Data files.

Structs§

NpyArray
An n-dimensional array read from or written to .npy.

Enums§

NpyData
The element data of an array, in C order.

Functions§

npy_decode
Decodes .npy bytes.
npy_encode
Encodes an array as a version 1.0 .npy file (little-endian, C order).
read_npy_file
Reads a .npy file.
write_npy_file
Writes a .npy file.