Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果您有array = np.array([1,2,3,4])并且index = np.array([0,1,2])您想要删除数组中的索引元素,那么在不循环的情况下执行此操作的最佳方法是什么?
array = np.array([1,2,3,4])
index = np.array([0,1,2])
您使用numpy.delete:
numpy.delete
smaller_array = np.delete(array,index)