我在进行多维数组两次切片操作后,想要修改其中的数据,但是无法修改,这是为什么?
import numpy as np
names = np.array(["张","李","王","赵"])
subjects = np.array(["English","Python","Math"])
scores = np.random.randint(0,6,size = (4,3))
print(scores)
print(scores[(names == "李"),:][:,subjects == "Math"])
scores[(names == "李"),:][:,subjects == "Math"] = scores[(names == "李"),:][:,subjects == "Math"] - 2
print(scores[(names == "李"),:][:,subjects == "Math"])
print(scores)
附上某一次的运行结果