Chapter 8

8.1 Life of ndarray

8.1.2 Block of memory


In [4]:
import numpy as np

In [5]:
x = np.array([1, 2, 3], dtype=np.int32)

In [6]:
x.data


Out[6]:
<read-write buffer for 0x00000000160709E0, size 12, offset 0 at 0x000000001606BF10>

In [7]:
bytes(x.data)


Out[7]:
'\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'

In [8]:
x.__array_interface__


Out[8]:
{'data': (68399184L, False),
 'descr': [('', '<i4')],
 'shape': (3L,),
 'strides': None,
 'typestr': '<i4',
 'version': 3}

In [ ]: