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

use numpy::pyo3::Python;
use numpy::ndarray::array;
use numpy::pyarray;

Python::with_gil(|py| {
    let array = pyarray![py, [1, 2], [3, 4]];

    assert_eq!(
        array.readonly().as_array(),
        array![[1, 2], [3, 4]]
    );
});