[英]Numpy: from a numpy array substract 1 to each element
我的 numpy 數組如下所示:
index_up = [ 71 99 103 ... 24872 24892 24928]
我需要的:
index_up = [ 70 98 102 ... 24871 24891 24927]
我試過了:
for e in index_up:
e = e-1
index_up[e] = e
但是沒有工作( index out of bounds
)有什么想法嗎? 謝謝!
使用以下代碼:
i=0
for e in index_up:
e = e-1
index_up[i]=e
i+=1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.