pub fn from_slice<'py>(py: Python<'py>, slice: &[T]) -> &'py Self {
        let array = PyArray::new(py, [slice.len()], false);
        unsafe {
            array.copy_ptr(slice.as_ptr(), slice.len());
        }
        array
    }
/// Construct one-dimension PyArray from slice.
///
/// # Example
/// ```
/// use numpy::PyArray;
/// let array = [1, 2, 3, 4, 5];
/// pyo3::Python::with_gil(|py| {
///     let pyarray = PyArray::from_slice(py, &array);
///     assert_eq!(pyarray.readonly().as_slice().unwrap(), &[1, 2, 3, 4, 5]);
/// });
/// ```
Construct one-dimension PyArray from slice.
Construct one - dimension PyArray from slice .
pub fn from_slice<'py>(py: Python<'py>, slice: &[T]) -> &'py Self {
        let array = PyArray::new(py, [slice.len()], false);
        unsafe {
            array.copy_ptr(slice.as_ptr(), slice.len());
        }
        array
    }
pub fn from_slice < ' py > ( py : Python < ' py > , slice : & [ T ] ) -> & ' py Self { let array = PyArray :: new ( py , [ slice . len ( ) ] , false ) ; unsafe { array . copy_ptr ( slice . as_ptr ( ) , slice . len ( ) ) ; } array }
Construct one-dimension PyArray from slice.
Construct one - dimension PyArray from slice .
py
Python<'py>
slice
&[T]
example
None