My code:
#!/usr/bin/python
import numpy as np
names = np.array(['Bob', 'Joe', 'Will', 'Bob', 'Will', 'Joe', 'Joe'])
data = np.random.randn(7, 4) + 0.8
print (data)
mask2= ((names != 'Joe') == 7.0)
d2 = data[mask2]
print (d2)
d3 = data[names != 'Joe'] = 7.0
print (d3)
Actually,my intention was to get the same solution both with mask and with other expression. I have solved it with Patric,s help
mask2= (names != 'Joe')
data[mask2] = 7.0
print (data)
Then I have:
[[ 7. 7. 7. 7. ]
[-0.73168514 2.26996071 -0.24892468 1.31421193]
[ 7. 7. 7. 7. ]
[ 7. 7. 7. 7. ]
[ 7. 7. 7. 7. ]
[ 0.74771766 2.44888399 0.62641731 -0.12963696]
[ 0.08604169 2.25468039 2.1960925 0.88218726]]
mask2 = names != 'Joe';data[mask2] = 7?