擅长:python、mysql、java
<p>这是我的解决方案,首先将2dim数组展平为1dim,然后恢复原始形状。你知道吗</p>
<pre class="lang-python prettyprint-override"><code>import pandas as pd
import numpy as np
mySeries = pd.Series(range(1, 100, 1))
myArray = np.array([[3, 10],[6, 9]])
flatArray = np.asarray(mySeries[myArray.ravel()])
resultArray = flatArray.reshape(myArray.shape)
# Output results
print(resultArray)
</code></pre>
<p>输出:</p>
<pre class="lang-none prettyprint-override"><code>[[ 4 11]
[ 7 10]]
</code></pre>