You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / ctypeslib / as_ctypes

function

numpy.ctypeslib:as_ctypes

source: /numpy/ctypeslib/_ctypeslib.py :561

Signature

def   as_ctypes ( obj )

Summary

Create and return a ctypes object from a numpy array. Actually anything that exposes the __array_interface__ is accepted.

Examples

Create ctypes object from inferred int ``np.array``:
inferred_int_array = np.array([1, 2, 3])
c_int_array = np.ctypeslib.as_ctypes(inferred_int_array)
type(c_int_array)
c_int_array[:]
Create ctypes object from explicit 8 bit unsigned int ``np.array`` :
exp_int_array = np.array([1, 2, 3], dtype=np.uint8)
c_int_array = np.ctypeslib.as_ctypes(exp_int_array)
type(c_int_array)
c_int_array[:]

Aliases

  • numpy.ctypeslib.as_ctypes

Referenced by