I am trying to understand the meaning of
ndarray.data -- Python buffer object pointing to the start of the array’s data
x = np.arange(5, dtype=np.float64)
y = x[3:1:-1]
>>> import numpy as np
>>> x = np.arange(5, dtype=np.float64)
>>> y = x[ 3:1:-1]
<memory at 0x000000F2F5150348>
<memory at 0x000000F2F5150408>
>>> int('0x000000F2F5150408', 16) - int('0x000000F2F5150348', 16)
>>> y.__array_interface__['data'] - x.__array_interface__['data']
So this begs the question, what does thegive?
Generally the number displayed by
x.data isn't meant to be used by you.
x.data is the buffer, which can be used in other contexts that expect a buffer.
x[3:]. But from Python you can't take
x.data, add 192 bits (3*8*8) to it, and expect to get
I often use the
__array_interface__['data'] value to check whether two variables share a data buffer, but I don't use that number for any thing. These are informative numbers, not working values.
I recently explored this in