numpy.at正是针对这些情况。
In [1]: np.add.at(X,tuple(coords.T),1)In [2]: XOut[2]: array([[ 1., 0., 0.], [ 0., 0., 3.], [ 0., 0., 0.]])

numpy.at正是针对这些情况。
In [1]: np.add.at(X,tuple(coords.T),1)In [2]: XOut[2]: array([[ 1., 0., 0.], [ 0., 0., 3.], [ 0., 0., 0.]])