Trait ndarray_npy::WriteNpyExt [−][src]
Extension trait for writing ArrayBase
to .npy
files.
If writes are expensive (e.g. for a file or network socket) and the layout
of the array is not known to be in standard or Fortran layout, it is
strongly recommended to wrap the writer in a BufWriter
. For the sake of
convenience, this method calls .flush()
on the writer
before returning.
Example
use ndarray::{array, Array2}; use ndarray_npy::WriteNpyExt; use std::fs::File; use std::io::BufWriter; let arr: Array2<i32> = array![[1, 2, 3], [4, 5, 6]]; let writer = BufWriter::new(File::create("array.npy")?); arr.write_npy(writer)?;
Required methods
fn write_npy<W: Write>(&self, writer: W) -> Result<(), WriteNpyError>
[src]
Writes the array to writer
in .npy
format.
This function is the Rust equivalent of
numpy.save
.
Implementations on Foreign Types
impl<A, S, D> WriteNpyExt for ArrayBase<S, D> where
A: WritableElement,
S: Data<Elem = A>,
D: Dimension,
[src]
Loading content...A: WritableElement,
S: Data<Elem = A>,
D: Dimension,