Skip to content

Commit 145d617

Browse files
committed
Change README example to load numpy itself
1 parent 9fa0173 commit 145d617

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ fn main() -> Result<(), ()> {
7878
}
7979

8080
fn main_<'py>(py: Python<'py>) -> PyResult<()> {
81-
let np = get_array_module(py)?;
81+
let np = py.import("numpy")?;
8282
let dict = PyDict::new(py);
8383
dict.set_item("np", np)?;
8484
let pyarray: &PyArray1<i32> = py
85-
.eval("np.array([1, 2, 3], dtype='int32')", Some(&dict), None)?
85+
.eval("np.absolute(np.array([-1, -2, -3], dtype='int32'))", Some(&dict), None)?
8686
.extract()?;
8787
let slice = pyarray.as_slice();
8888
assert_eq!(slice, &[1, 2, 3]);

0 commit comments

Comments
 (0)