我有一个numpy-array
X_test = [array([1,2]), array([3,4]), array([5,6]), array([7,8]), array([9,10]), array([11,12])]
我会删除每一行以获得一个新数组:
[array([3,4]), array([5,6]), array([7,8]), array([9,10]), array([11,12])]
[array([1,2]), array([5,6]), array([7,8]), array([9,10]), array([11,12])]
[array([1,2]), array([3,4]), array([7,8]), array([9,10]), array([11,12])]
[array([1,2]), array([3,4]), array([5,6]), array([9,10]), array([11,12])]
[array([1,2]), array([3,4]), array([5,6]), array([7,8]), array([11,12])]
[array([1,2]), array([3,4]), array([5,6]), array([7,8]), array([9,10])]
我曾尝试过这样的阵列:
for i in range(len(X_test)):
np.delete(X_test, i)
print X_test
答案 0 :(得分:0)
[X_test[:i] + X_test[i+1:] for i in range(len(X_test))]
为您提供包含所需元素的列表