@@ -1449,7 +1449,7 @@ def col(t,column):
1449
1449
tables .__version__ = v
1450
1450
self .assertRaises (Exception , store .create_table_index , 'f' )
1451
1451
1452
- for v in ['2.3.1' , '2.3.1b' , '2.4dev' , '2.4' , original ]:
1452
+ for v in ['2.3.1' , '2.3.1b' , '2.4dev' , '2.4' , '3.0.0' , '3.1.0' , original ]:
1453
1453
pytables ._table_mod = None
1454
1454
pytables ._table_supports_index = False
1455
1455
tables .__version__ = v
@@ -3732,6 +3732,26 @@ def test_select_as_multiple(self):
3732
3732
self .assertRaises (ValueError , store .select_as_multiple ,
3733
3733
['df1' ,'df3' ], where = ['A>0' , 'B>0' ], selector = 'df1' )
3734
3734
3735
+
3736
+ def test_nan_selection_bug_4858 (self ):
3737
+
3738
+ # GH 4858; nan selection bug, only works for pytables >= 3.1
3739
+ if LooseVersion (tables .__version__ ) < '3.1.0' :
3740
+ raise nose .SkipTest ('tables version does not support fix for nan selection bug: GH 4858' )
3741
+
3742
+ with ensure_clean_store (self .path ) as store :
3743
+
3744
+ df = DataFrame (dict (cols = range (6 ), values = range (6 )), dtype = 'float64' )
3745
+ df ['cols' ] = (df ['cols' ]+ 10 ).apply (str )
3746
+ df .iloc [0 ] = np .nan
3747
+
3748
+ expected = DataFrame (dict (cols = ['13.0' ,'14.0' ,'15.0' ], values = [3. ,4. ,5. ]), index = [3 ,4 ,5 ])
3749
+
3750
+ # write w/o the index on that particular column
3751
+ store .append ('df' ,df , data_columns = True ,index = ['cols' ])
3752
+ result = store .select ('df' ,where = 'values>2.0' )
3753
+ assert_frame_equal (result ,expected )
3754
+
3735
3755
def test_start_stop (self ):
3736
3756
3737
3757
with ensure_clean_store (self .path ) as store :
0 commit comments