numpy 遇到如下問題,請問怎么解決?
上代碼
import numpy as np
a=np.array([0,1])
def f(x):
return [0,1][x]
f(a)
反饋出錯資訊:
TypeError: only integer scalar arrays can be converted to a scalar index
請問哪位知道是什么原因?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/116637.html
上一篇:Python資料框
