You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide an efficient way to go from Array<Py<T>, D> to PyArray<PyObject, D>.
The base way to construct a PyArray containing objects in a strongly typed
manner is to crate a ndarray::Array<Py<T>, D> instead of converting it into a
PyArray without copying using this method.
Copy file name to clipboardExpand all lines: src/dtype.rs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,8 @@ impl PyArrayDescr {
126
126
/// eliminated in the resulting NumPy array.
127
127
/// In other words, objects are always treated as `Py<PyAny>` (a.k.a. `PyObject`) by Python code,
128
128
/// and only `Py<PyAny>` can be stored in a type safe manner.
129
+
///
130
+
/// You can however create `ndarray::Array<Py<T>, D>` and turn that into a NumPy array safely and efficiently using [`from_owned_object_array`][crate::PyArray::from_owned_object_array].
129
131
pubunsafetraitElement:Clone + Send{
130
132
/// Flag that indicates whether this type is trivially copyable.
0 commit comments