下面的代码是为了检查 Python ND-Array 列中的 NaN 值而编写的。如果 temparr1 或 temparr2 中有一个 NaN,我们从它们中删除相应的行。问题是,它似乎不起作用。你能帮帮我吗?
temparr1=arr[index[indexkey]][:]// We get a column from arr, an nd-array of size 0 to 9470
temparr2=arr[index[secondIndexKey]][:]// Same as above, but with the next column
rwc=range(0,len(arr)) We get a bit vector of a sort to check.
for i in range(0,len(arr)):
if(isnan(temparr1[i]) or isnan(temparr2[i]) ):
rwc = rwc[:i-1]+rwc[i+1:] // Remove the value from the bit Vector for a NaN value in the arrays.
print i
temparr1 = []
temparr2 = []
for i in rwc:
temparr1.append(arr[index[indexkey]][i])
temparr2.append(arr[index[secondIndexKey]][i])// Extract the data for the corresponding values in RWC and get them into the temparrs.
有人可以告诉我为什么它不起作用,为什么我仍然得到 NaN 吗?
一个数组看起来像: [99,242,122,nan,42,nan,414,........]