Struct ndarray_npy::NpzReader [−][src]
Expand description
Reader for .npz
files.
Example
use ndarray::{Array1, Array2};
use ndarray_npy::NpzReader;
use std::fs::File;
let mut npz = NpzReader::new(File::open("arrays.npz")?)?;
let a: Array2<i32> = npz.by_name("a")?;
let b: Array1<i32> = npz.by_name("b")?;
Implementations
Creates a new .npz
file reader.
Returns the names of all of the arrays in the file.
pub fn by_name<S, D>(
&mut self,
name: &str
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
pub fn by_name<S, D>(
&mut self,
name: &str
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
Reads an array by name.
pub fn by_index<S, D>(
&mut self,
index: usize
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
pub fn by_index<S, D>(
&mut self,
index: usize
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
Reads an array by index in the .npz
file.