1.numpy.where() 的用法详解
官方文档:https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html
np.where(condition,x,y)
满足条件输出x,不满足条件输出y。
np.where(condition)
如果只有条件没有x,y.则相当于
np.asarray(condition).nonzero()
官方文档:https://docs.scipy.org/doc/numpy/reference/generated/numpy.nonzero.html#numpy.nonzero
返回满足条件的下标。numpy数组有多少纬度。返回结果tuple数组就有多少个。
2. numpy newaxis为了增加维度