以元素为单位列出数字列表的最佳方法是什么?
例如
[[1,2,3],[2,3,4],[3,4,5]]
-> [6,24,60]
Run Code Online (Sandbox Code Playgroud)
用途np.prod:
>>> a = np.array([[1,2,3],[2,3,4],[3,4,5]])
>>> np.prod(a,axis=1)
array([ 6, 24, 60])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2725 次 |
| 最近记录: |