Replies: 1 comment 4 replies
-
I think the easiest way to achieve this is to use fn array2_to_vec2(array: PyReadonlyArray2<f64>) -> Vec<Vec<f64>> {
array
.as_array()
.rows()
.into_iter()
.map(|row| row.iter().copied().collect::<Vec<_>>())
.collect::<Vec<_>>()
} But that said, this is an usual conversion as the resulting memory layout is relatively inefficient compared to storing the two-dimensional array in a single allocation. Maybe you could expand a little on why you need |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
PyReadonlyArray2 how to convert to vec<vec>? thanks
Beta Was this translation helpful? Give feedback.
All reactions