Bug#972015: Bug#972033: python3.9 pandas

Rebecca N. Palmer rebecca_palmer at zoho.com
Sat Oct 17 11:12:07 BST 2020


This bug is not specific to DateTimeIndexes, and the immediate cause is 
the index being passed to numpy as a 
pandas.core.computation.pytables.Constant instead of an int:

$ python3.9
Python 3.9.0+ (default, Oct 16 2020, 17:57:59)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pandas as pd;from pandas.io.pytables import 
HDFStore;s1=HDFStore("tmp1.h5","w");df=pd.DataFrame([[1,2,3],[4,5,6]],columns=['A','B','C']);s1.append("d1",df,data_columns=["B"]);df2=s1.select("d1","index>df.index[0]");print(type(df2.index[0]))
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib/python3/dist-packages/pandas/io/pytables.py", line 
876, in select
     return it.get_result()
   File "/usr/lib/python3/dist-packages/pandas/io/pytables.py", line 
1930, in get_result
     results = self.func(self.start, self.stop, where)
   File "/usr/lib/python3/dist-packages/pandas/io/pytables.py", line 
860, in func
     return s.read(start=_start, stop=_stop, where=_where, columns=columns)
   File "/usr/lib/python3/dist-packages/pandas/io/pytables.py", line 
4483, in read
     result = self._read_axes(where=where, start=start, stop=stop)
   File "/usr/lib/python3/dist-packages/pandas/io/pytables.py", line 
3682, in _read_axes
     selection = Selection(self, where=where, start=start, stop=stop)
   File "/usr/lib/python3/dist-packages/pandas/io/pytables.py", line 
5167, in __init__
     self.terms = self.generate(where)
   File "/usr/lib/python3/dist-packages/pandas/io/pytables.py", line 
5180, in generate
     return PyTablesExpr(where, queryables=q, encoding=self.table.encoding)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/pytables.py", 
line 573, in __init__
     self.terms = self.parse()
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
806, in parse
     return self._visitor.visit(self.expr)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
398, in visit
     return visitor(node, **kwargs)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
404, in visit_Module
     return self.visit(expr, **kwargs)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
398, in visit
     return visitor(node, **kwargs)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
407, in visit_Expr
     return self.visit(node.value, **kwargs)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
398, in visit
     return visitor(node, **kwargs)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
699, in visit_Compare
     return self.visit(binop)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
398, in visit
     return visitor(node, **kwargs)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
520, in visit_BinOp
     op, op_class, left, right = self._maybe_transform_eq_ne(node)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
441, in _maybe_transform_eq_ne
     right = self.visit(node.right, side="right")
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/expr.py", line 
398, in visit
     return visitor(node, **kwargs)
   File 
"/usr/lib/python3/dist-packages/pandas/core/computation/pytables.py", 
line 430, in visit_Subscript
     return self.const_type(value[slobj], self.env)
   File "/usr/lib/python3/dist-packages/pandas/core/indexes/range.py", 
line 720, in __getitem__
     return super().__getitem__(key)
   File "/usr/lib/python3/dist-packages/pandas/core/indexes/base.py", 
line 4111, in __getitem__
     result = getitem(key)
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis 
(`None`) and integer or boolean arrays are valid indices
 >>> import pdb;pdb.pm()
 > 
/usr/lib/python3/dist-packages/pandas/core/indexes/base.py(4111)__getitem__()
-> result = getitem(key)
(Pdb) p key
0
(Pdb) p type(key)
<class 'pandas.core.computation.pytables.Constant'>
(Pdb)



More information about the debian-science-maintainers mailing list