Trait ndarray_npy::ReadNpyExt [−][src]
pub trait ReadNpyExt: Sized {
fn read_npy<R: Read>(reader: R) -> Result<Self, ReadNpyError>;
}
Expand description
Extension trait for reading Array
from .npy
files.
Example
use ndarray::Array2;
use ndarray_npy::ReadNpyExt;
use std::fs::File;
let reader = File::open("resources/array.npy")?;
let arr = Array2::<i32>::read_npy(reader)?;
Required methods
fn read_npy<R: Read>(reader: R) -> Result<Self, ReadNpyError>
fn read_npy<R: Read>(reader: R) -> Result<Self, ReadNpyError>
Reads the array from reader
in .npy
format.
This function is the Rust equivalent of
numpy.load
for .npy
files.