[Numpy-discussion] slices of structured arrays?
Tue Dec 8 19:32:25 CST 2009
Here's a structured array with fields 'a','b' and 'c':
s=[(i,int) for i in 'abc']
It has the form: array([(0, 0, 0)]
I was wondering if such an array can be accessed like an
ordinary array (e.g., with a slice) in order to set multiple
values at once.
t does not access the first element of the array, instead
it returns the whole array.
In : t
Out: (1, 0, 0)
But this array is type np.void and does not support slices.
t returns the first element, but t[:2] fails with
IndexError: invalid index.
More information about the NumPy-Discussion