import numpy as np
a = np.arange(12).reshape(3,4)
print(a)
结果
[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]]
print(np.delete(a,2))
[ 0 1 3 4 5 6 7 8 9 10 11]
删除每行的指定元素后平铺
print(np.delete(a,2,axis= 1))
[[ 0 1 3]
[ 4 5 7]
[ 8 9 11]]
删除每行的指定元素 不平铺