Macro numpy::pyarray [−][src]
macro_rules! pyarray { ($py : ident, $([$([$($x : expr), * $(,) *]), + $(,) *]), + $(,) *) => { ... }; ($py : ident, $([$($x : expr), * $(,) *]), + $(,) *) => { ... }; ($py : ident, $($x : expr), * $(,) *) => { ... }; }
Expand description
Create a PyArray with one, two or three dimensions.
This macro is backed by
ndarray::array
.
Example
pyo3::Python::with_gil(|py| { let array = numpy::pyarray![py, [1, 2], [3, 4]]; assert_eq!( array.readonly().as_array(), ndarray::array![[1, 2], [3, 4]] ); });