[][src]Crate ndarray_npy

This crate provides methods to read/write ndarray's ArrayBase type from/to .npy and .npz files.

See the ReadNpyExt and WriteNpyExt extension traits or the read_npy and write_npy convenience functions for reading/writing .npy files.

See NpzReader and NpzWriter for reading/writing .npz files.

See the repository for information about the default features and how to use this crate with Cargo.

Limitations

  • Parsing of .npy files is currently limited to files where the descr field of the header dictionary is a Python string literal of the form 'string', "string", '''string''', or """string""".

  • WritableElement and ReadableElement are currently implemented only for fixed-size integers, floating point numbers, and bool.

The plan is to add support for more element types (including custom user-defined structs) in the future.

Structs

NpzReader

Reader for .npz files.

NpzWriter

Writer for .npz files.

Enums

ReadDataError

An error reading array data.

ReadNpyError

An error reading a .npy file.

ReadNpzError

An error reading a .npz file.

WriteDataError

An error writing array data.

WriteNpyError

An error writing a .npy file.

WriteNpzError

An error writing a .npz file.

Traits

ReadNpyExt

Extension trait for reading Array from .npy files.

ReadableElement

An array element type that can be read from an .npy or .npz file.

WritableElement

An array element type that can be written to an .npy or .npz file.

WriteNpyExt

Extension trait for writing ArrayBase to .npy files.

Functions

read_npy

Read an .npy file located at the specified path.

write_npy

Writes an array to an .npy file at the specified path.