riptable
riptable copied to clipboard
invalid int equals itself in comparison, while np.nan doesn't
np.nan == np.nan False
a = np.array([1,2,3,np.nan]) ds = rt.Dataset({'f': [0,0,0, 0], 'g': a})
a == a array([ True, True, True, False])
ds['g'] == ds['g'] FastArray([ True, True, True, False])
ds[0, 'f'] = np.nan ds['f'] == ds['f']
FastArray([ True, True, True, True])
Here is another limitation in current implementation of inv integers: if I write my own function taking a FastArray as input, it is easy to make a mistake:
ds = rt.Dataset({'f': [1,2,3,4]})
ds[0, 'f'] = np.nan
print(ds)
# f
- ---
0 Inv
1 2
2 3
3 4
print(ds['f'])
[-9223372036854775808 2 3
4]
tmp = 0
for i in range(4):
tmp += ds[i, 'f']
print(tmp)
-9223372036854775799