Closed
Description
Assigning values to Numpy structured arrays produces very odd behavior. For example, the following does not assign correctly:
H = np.zeros(4, dtype=[('ind','float')])
H['ind'] = np.arange(1,5)
H['ind']
array([ 1., 2., 3., 4.])
x = [False, True, False, True]
H['ind'][np.ix_(x)]
array([ 2., 4.])
H[np.ix_(x)]['ind'] = [-1, -1]
H
array([(1.0,), (2.0,), (3.0,), (4.0,)],
dtype=[('ind', '<f8')])
If I attempt to make the change recommended here: #3561, it still does not even change the first entry indexed:
H[np.ix_(x)]['ind'][:] = [-1,-1]
H
array([(1.0,), (2.0,), (3.0,), (4.0,)],
dtype=[('ind', '<f8')])
Why might this be the case?
Metadata
Metadata
Assignees
Labels
No labels