我在 python 中有以下二维数组
[[(0, 0, 0), 337.94174378689814],
[(0, 0, 1), 339.92776762374007],
[(0, 0, 2), 338.78632729456444],
[(0, 1, 0), 344.85997106879347],
[(0, 1, 1), 331.6819890120493],
[0, 0]]
我想删除其中有 0 个值的元素输出是 ARIMA order and corresponding AIC score
我从下面的代码生成
a = [[0]*2 for x in range(27)]
for i in range(len(pdq)):
try:
mod = ARIMA(train, order = pdq[i])
results = mod.fit(disp=False)
a[i][0] = pdq[i]
a[i][1] = results.aic
if a[i][1] == 0:
a.remove(a[i])
except:
continue
我想删除数组中同时存在 0
的值。我该怎么做 if condition described above
原文由 Neil 发布,翻译遵循 CC BY-SA 4.0 许可协议
如果你只想删除 [0,0] 你可以这样做:
或者使用过滤器: