IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
22.4 Creating an array from a MemmapSlice


22.4 Creating an array from a MemmapSlice

Arrays are created from MemmapSlices simply by specifying the slice as the buffer parameter of the array. Since the slice is essentially just a byte string, it's necessary to specify the type of the binary data as well.

>>> a = num.NumArray(buffer=n, shape=(len(n)/4,), type=num.Int32)
>>> a[:] = 0  # Since the initial contents of 'n' are undefined.
>>> a += 1
array([1, 1, 1, 1], type=Int32)

Send comments to the NumArray community.