【发布时间】:2016-08-24 22:21:18
【问题描述】:
import numpy as np
a = np.array([[1,2],
[3,4],
[5,6],
[7,8],
[9,10],
[11,12]])
print np.shape(a)
预期的答案应该是:
answer = np.array([[1,2,7,8],
[3,4, 9, 10],
[5,6, 11, 12]])
我试过了
ans = a.reshape(3,-1)
print ans
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]]
但答案是错误的。怎么做?
【问题讨论】: