A Tuesday 30 November 2010 15:57:12 Charles Krohn escrigué:
> Thanks again for taking a look. What do you mean by "work
> incorrectly"? Will where() return the wrong rows for conditions
> involving columns with NaNs? Could this happen on any column with
> NaNs?
Exactly. NaNs behave in a strange way:
>>> np.nan < 1
False
>>> np.nan >= 1
False
>>> np.nan == np.nan
False
so you cannot establish a relation of order with them (unless this
support is done explicitly in some way or in another). That renders
indexes containing NaNs basically useless. By using your single-column
table, see the result of a query without indexing:
>>> f_ni = tables.openFile("/tmp/test.h5", "r")
>>> len([r.nrow for r in f_ni.root.test.where("(col<1.1)&(col>.5)")])
156813
See a query with the column indexed:
>>> f_idx = tables.openFile("/tmp/indexed_test.h5", "r")
>>> len([r.nrow for r in f_idx.root.test.where("(col<1.1)&(col>.5)")])
0
My suggestion is that you replace the NaN's in your columns with other
values, or even with +inf or -inf. In this case you can use indexation
without problem.
Hope this helps,
--
Francesc Alted
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users