From 4609bfa1a3f2d5e16d7c32bf65c6d940bcc5f84c Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 24 Nov 2020 09:23:47 -0800 Subject: [PATCH 1/4] BUG: pytables in py39 --- pandas/core/computation/pytables.py | 4 ++++ pandas/tests/io/pytables/test_store.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/core/computation/pytables.py b/pandas/core/computation/pytables.py index 6ec637a8b4845..0498d4d171c00 100644 --- a/pandas/core/computation/pytables.py +++ b/pandas/core/computation/pytables.py @@ -430,6 +430,10 @@ def visit_Subscript(self, node, **kwargs): except AttributeError: pass + if isinstance(slobj, Term): + # In py39 np.ndarray lookups with Term containing int raise + slobj = slobj.value + try: return self.const_type(value[slobj], self.env) except TypeError as err: diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index 32d1cf82c4330..afd2f56efb935 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -4462,7 +4462,7 @@ def test_categorical(self, setup_path): # Appending must have the same categories df3 = df.copy() - df3["s"].cat.remove_unused_categories(inplace=True) + df3["s"] = df3["s"].cat.remove_unused_categories() with pytest.raises(ValueError): store.append("df3", df3) From 75743ff814f3528d4ae5af26807f162e629ac01c Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 24 Nov 2020 17:20:40 -0800 Subject: [PATCH 2/4] add pytables to py39 ci --- ci/deps/azure-39.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/deps/azure-39.yaml b/ci/deps/azure-39.yaml index 67edc83a9d738..90ba3fe22c8a6 100644 --- a/ci/deps/azure-39.yaml +++ b/ci/deps/azure-39.yaml @@ -15,3 +15,6 @@ dependencies: - numpy - python-dateutil - pytz + + # optional dependencies + - pytables From 34f7434c803c21f7d8d9822e01534cc58670e932 Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 24 Nov 2020 18:13:10 -0800 Subject: [PATCH 3/4] whatsnew 1.1.5 --- doc/source/whatsnew/v1.1.5.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/whatsnew/v1.1.5.rst b/doc/source/whatsnew/v1.1.5.rst index 609c3650c8cc2..dd88f79371d65 100644 --- a/doc/source/whatsnew/v1.1.5.rst +++ b/doc/source/whatsnew/v1.1.5.rst @@ -28,6 +28,7 @@ Bug fixes - Bug in metadata propagation for ``groupby`` iterator (:issue:`37343`) - Bug in indexing on a :class:`Series` with ``CategoricalDtype`` after unpickling (:issue:`37631`) - Bug in :class:`RollingGroupby` with the resulting :class:`MultiIndex` when grouping by a label that is in the index (:issue:`37641`) +- Bug in pytables methods in python 3.9 (:issue:`38041`) - .. --------------------------------------------------------------------------- From dfaa1c49d8ca73cc0c050407b48703e3e4a17031 Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 24 Nov 2020 18:14:01 -0800 Subject: [PATCH 4/4] scipy and pyarrow to py39 build --- ci/deps/azure-39.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/deps/azure-39.yaml b/ci/deps/azure-39.yaml index 90ba3fe22c8a6..c4c84e73fa684 100644 --- a/ci/deps/azure-39.yaml +++ b/ci/deps/azure-39.yaml @@ -18,3 +18,5 @@ dependencies: # optional dependencies - pytables + - scipy + - pyarrow=1.0