From cd851403a4869f165c81b3b727724022007216b0 Mon Sep 17 00:00:00 2001 From: jreback Date: Wed, 5 Feb 2014 08:15:21 -0500 Subject: [PATCH] BLD: add support for pytables 3.1 BLD: update 3.3 build for numexpr 2.3 --- ci/requirements-3.3.txt | 4 ++-- pandas/io/tests/test_pytables.py | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ci/requirements-3.3.txt b/ci/requirements-3.3.txt index 73009b572c4c2..8bc7f0bb44fac 100644 --- a/ci/requirements-3.3.txt +++ b/ci/requirements-3.3.txt @@ -6,8 +6,8 @@ xlrd==0.9.2 html5lib==1.0b2 numpy==1.8.0 cython==0.19.1 -numexpr==2.1 -tables==3.0.0 +numexpr==2.3 +tables==3.1.0 matplotlib==1.2.1 patsy==0.1.0 lxml==3.2.1 diff --git a/pandas/io/tests/test_pytables.py b/pandas/io/tests/test_pytables.py index 568a4aaf29486..5609dfcc6eee0 100644 --- a/pandas/io/tests/test_pytables.py +++ b/pandas/io/tests/test_pytables.py @@ -1449,7 +1449,7 @@ def col(t,column): tables.__version__ = v self.assertRaises(Exception, store.create_table_index, 'f') - for v in ['2.3.1', '2.3.1b', '2.4dev', '2.4', original]: + for v in ['2.3.1', '2.3.1b', '2.4dev', '2.4', '3.0.0', '3.1.0', original]: pytables._table_mod = None pytables._table_supports_index = False tables.__version__ = v @@ -3732,6 +3732,26 @@ def test_select_as_multiple(self): self.assertRaises(ValueError, store.select_as_multiple, ['df1','df3'], where=['A>0', 'B>0'], selector='df1') + + def test_nan_selection_bug_4858(self): + + # GH 4858; nan selection bug, only works for pytables >= 3.1 + if LooseVersion(tables.__version__) < '3.1.0': + raise nose.SkipTest('tables version does not support fix for nan selection bug: GH 4858') + + with ensure_clean_store(self.path) as store: + + df = DataFrame(dict(cols = range(6), values = range(6)), dtype='float64') + df['cols'] = (df['cols']+10).apply(str) + df.iloc[0] = np.nan + + expected = DataFrame(dict(cols = ['13.0','14.0','15.0'], values = [3.,4.,5.]), index=[3,4,5]) + + # write w/o the index on that particular column + store.append('df',df, data_columns=True,index=['cols']) + result = store.select('df',where='values>2.0') + assert_frame_equal(result,expected) + def test_start_stop(self): with ensure_clean_store(self.path) as store: