我想将数组划分为随机大小而不是特定大小。我该怎么办?
B= np.array([[0 ,1, 0, 0, 1, 1, 0, 1, 0, 0],
[1, 0, 1, 1, 0, 1, 0, 1, 1, 0],
[0, 1, 0, 1, 1, 0, 0, 0, 1, 0],
[0, 1, 1, 0, 0, 0, 1, 0, 1, 1],
[1, 0, 1, 0, 0, 1, 1, 0, 1, 0],
[1, 1, 0, 0, 1, 0, 0, 0, 1, 1],
[0, 0, 0, 1, 1, 0, 0, 1, 0, 0],
[1, 1, 0, 0, 0, 0, 1, 0, 0, 1],
[0, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 1, 0, 1, 0, 0]])
new = [2,1,3,5,6,7,9,8]
B1 = np.array([[B[i][j]for j in new] for i in new])
result = []
for _ in xrange(0,5):
split_ = B1[0:i+1,0:i+1]
result.append(split_)