Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #38041 on branch 1.1.x: BUG: pytables in py39 (#38041) #38061

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions ci/deps/azure-39.yaml
Expand Up @@ -15,3 +15,8 @@ dependencies:
- numpy
- python-dateutil
- pytz

# optional dependencies
- pytables
- scipy
- pyarrow=1.0
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.1.5.rst
Expand Up @@ -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`)
-

.. ---------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions pandas/core/computation/pytables.py
Expand Up @@ -426,6 +426,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:
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/pytables/test_store.py
Expand Up @@ -4500,7 +4500,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)
Expand Down