擅长:python、mysql、java
<p>我无法想象为什么numpy会需要这样的方法。这是,或多或少,一个肾盂解决方案。你知道吗</p>
<pre><code>import numpy as np
# an example array with shape [2,3,4]
a = np.random.random([2,3,4])
# create the target array shaped [2,3] with 'object' type (accepting other types than numbers).
b = np.array([[None for row in mat] for mat in a])
for i in range(b.shape[0]):
for j in range(b.shape[1]):
b[i,j] = list(a[i,j])
</code></pre>