Bug#972033: Bug#969650: Bug#972033: python3.9, dask, pandas 1.1
Rebecca N. Palmer
rebecca_palmer at zoho.com
Fri Oct 16 19:49:52 BST 2020
Control: tags -1 - pending
The package currently in Salsa doesn't work. test_statsmodels is
probably a circular dependency that should be ignored for now;
TestHDFStore is under investigation.
=================================== FAILURES
===================================
________________ TestHDFStore.test_append_frame_column_oriented
________________
self = <pandas.tests.io.pytables.test_store.TestHDFStore object at
0x7f753e5ba2e0>
setup_path = 'tmp.__PxTZkyR5w5__.h5'
@pytest.mark.xfail(condition=is_crashing_arch,reason="https://bugs.debian.org/790925",strict=False,run=False)
def test_append_frame_column_oriented(self, setup_path):
with ensure_clean_store(setup_path) as store:
# column oriented
df = tm.makeTimeDataFrame()
df.index = df.index._with_freq(None) # freq doesnt round-trip
_maybe_remove(store, "df1")
store.append("df1", df.iloc[:, :2], axes=["columns"])
store.append("df1", df.iloc[:, 2:])
tm.assert_frame_equal(store["df1"], df)
result = store.select("df1", "columns=A")
expected = df.reindex(columns=["A"])
tm.assert_frame_equal(expected, result)
# selection on the non-indexable
result = store.select("df1", ("columns=A",
"index=df.index[0:4]"))
expected = df.reindex(columns=["A"], index=df.index[0:4])
tm.assert_frame_equal(expected, result)
# this isn't supported
with pytest.raises(TypeError):
> store.select("df1", "columns=A and index>df.index[4]")
pandas/tests/io/pytables/test_store.py:1336:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
pandas/io/pytables.py:876: in select
return it.get_result()
pandas/io/pytables.py:1930: in get_result
results = self.func(self.start, self.stop, where)
pandas/io/pytables.py:860: in func
return s.read(start=_start, stop=_stop, where=_where, columns=columns)
pandas/io/pytables.py:4483: in read
result = self._read_axes(where=where, start=start, stop=stop)
pandas/io/pytables.py:3682: in _read_axes
selection = Selection(self, where=where, start=start, stop=stop)
pandas/io/pytables.py:5167: in __init__
self.terms = self.generate(where)
pandas/io/pytables.py:5180: in generate
return PyTablesExpr(where, queryables=q, encoding=self.table.encoding)
pandas/core/computation/pytables.py:573: in __init__
self.terms = self.parse()
pandas/core/computation/expr.py:806: in parse
return self._visitor.visit(self.expr)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:404: in visit_Module
return self.visit(expr, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:407: in visit_Expr
return self.visit(node.value, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:726: in visit_BoolOp
return reduce(visitor, operands)
pandas/core/computation/expr.py:720: in visitor
rhs = self._try_visit_binop(y)
pandas/core/computation/expr.py:715: in _try_visit_binop
return self.visit(bop)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:699: in visit_Compare
return self.visit(binop)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:520: in visit_BinOp
op, op_class, left, right = self._maybe_transform_eq_ne(node)
pandas/core/computation/expr.py:441: in _maybe_transform_eq_ne
right = self.visit(node.right, side="right")
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/pytables.py:430: in visit_Subscript
return self.const_type(value[slobj], self.env)
pandas/core/indexes/extension.py:215: in __getitem__
result = self._data[key]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = <DatetimeArray>
['2000-01-03 00:00:00', '2000-01-04 00:00:00', '2000-01-05 00:00:00',
'2000-01-06 00:00:00', '2000-01...2-08 00:00:00',
'2000-02-09 00:00:00', '2000-02-10 00:00:00', '2000-02-11 00:00:00']
Length: 30, dtype: datetime64[ns]
key = 4
def __getitem__(self, key):
"""
This getitem defers to the underlying array, which
by-definition can
only handle list-likes, slices, and integer scalars
"""
if lib.is_integer(key):
# fast-path
result = self._data[key]
if self.ndim == 1:
return self._box_func(result)
return self._simple_new(result, dtype=self.dtype)
if com.is_bool_indexer(key):
# first convert to boolean, because check_array_indexer doesn't
# allow object dtype
if is_object_dtype(key):
key = np.asarray(key, dtype=bool)
key = check_array_indexer(self, key)
key = lib.maybe_booleans_to_slice(key.view(np.uint8))
elif isinstance(key, list) and len(key) == 1 and
isinstance(key[0], slice):
# see https://github.com/pandas-dev/pandas/issues/31299,
need to allow
# this for now (would otherwise raise in check_array_indexer)
pass
else:
key = check_array_indexer(self, key)
freq = self._get_getitem_freq(key)
> result = self._data[key]
E IndexError: only integers, slices (`:`), ellipsis (`...`),
numpy.newaxis (`None`) and integer or boolean arrays are valid indices
pandas/core/arrays/datetimelike.py:559: IndexError
__________________ TestHDFStore.test_append_with_data_columns
__________________
self = <pandas.tests.io.pytables.test_store.TestHDFStore object at
0x7f75179bde20>
setup_path = 'tmp.__zAu5cCxZKU__.h5'
def test_append_with_data_columns(self, setup_path):
with ensure_clean_store(setup_path) as store:
df = tm.makeTimeDataFrame()
df.iloc[0, df.columns.get_loc("B")] = 1.0
_maybe_remove(store, "df")
store.append("df", df[:2], data_columns=["B"])
store.append("df", df[2:])
tm.assert_frame_equal(store["df"], df)
# check that we have indices created
assert store._handle.root.df.table.cols.index.is_indexed is
True
assert store._handle.root.df.table.cols.B.is_indexed is True
# data column searching
result = store.select("df", "B>0")
expected = df[df.B > 0]
tm.assert_frame_equal(result, expected)
# data column searching (with an indexable and a data_columns)
> result = store.select("df", "B>0 and index>df.index[3]")
pandas/tests/io/pytables/test_store.py:1560:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
pandas/io/pytables.py:876: in select
return it.get_result()
pandas/io/pytables.py:1930: in get_result
results = self.func(self.start, self.stop, where)
pandas/io/pytables.py:860: in func
return s.read(start=_start, stop=_stop, where=_where, columns=columns)
pandas/io/pytables.py:4483: in read
result = self._read_axes(where=where, start=start, stop=stop)
pandas/io/pytables.py:3682: in _read_axes
selection = Selection(self, where=where, start=start, stop=stop)
pandas/io/pytables.py:5167: in __init__
self.terms = self.generate(where)
pandas/io/pytables.py:5180: in generate
return PyTablesExpr(where, queryables=q, encoding=self.table.encoding)
pandas/core/computation/pytables.py:573: in __init__
self.terms = self.parse()
pandas/core/computation/expr.py:806: in parse
return self._visitor.visit(self.expr)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:404: in visit_Module
return self.visit(expr, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:407: in visit_Expr
return self.visit(node.value, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:726: in visit_BoolOp
return reduce(visitor, operands)
pandas/core/computation/expr.py:720: in visitor
rhs = self._try_visit_binop(y)
pandas/core/computation/expr.py:715: in _try_visit_binop
return self.visit(bop)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:699: in visit_Compare
return self.visit(binop)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:520: in visit_BinOp
op, op_class, left, right = self._maybe_transform_eq_ne(node)
pandas/core/computation/expr.py:441: in _maybe_transform_eq_ne
right = self.visit(node.right, side="right")
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/pytables.py:430: in visit_Subscript
return self.const_type(value[slobj], self.env)
pandas/core/indexes/extension.py:215: in __getitem__
result = self._data[key]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = <DatetimeArray>
['2000-01-03 00:00:00', '2000-01-04 00:00:00', '2000-01-05 00:00:00',
'2000-01-06 00:00:00', '2000-01...2-08 00:00:00',
'2000-02-09 00:00:00', '2000-02-10 00:00:00', '2000-02-11 00:00:00']
Length: 30, dtype: datetime64[ns]
key = 3
def __getitem__(self, key):
"""
This getitem defers to the underlying array, which
by-definition can
only handle list-likes, slices, and integer scalars
"""
if lib.is_integer(key):
# fast-path
result = self._data[key]
if self.ndim == 1:
return self._box_func(result)
return self._simple_new(result, dtype=self.dtype)
if com.is_bool_indexer(key):
# first convert to boolean, because check_array_indexer doesn't
# allow object dtype
if is_object_dtype(key):
key = np.asarray(key, dtype=bool)
key = check_array_indexer(self, key)
key = lib.maybe_booleans_to_slice(key.view(np.uint8))
elif isinstance(key, list) and len(key) == 1 and
isinstance(key[0], slice):
# see https://github.com/pandas-dev/pandas/issues/31299,
need to allow
# this for now (would otherwise raise in check_array_indexer)
pass
else:
key = check_array_indexer(self, key)
freq = self._get_getitem_freq(key)
> result = self._data[key]
E IndexError: only integers, slices (`:`), ellipsis (`...`),
numpy.newaxis (`None`) and integer or boolean arrays are valid indices
pandas/core/arrays/datetimelike.py:559: IndexError
_______________________ TestHDFStore.test_invalid_terms
________________________
self = <pandas.tests.io.pytables.test_store.TestHDFStore object at
0x7f753e359430>
setup_path = 'tmp.__mFQj4Z0toA__.h5'
def test_invalid_terms(self, setup_path):
with ensure_clean_store(setup_path) as store:
with catch_warnings(record=True):
df = tm.makeTimeDataFrame()
df["string"] = "foo"
df.loc[df.index[0:4], "string"] = "bar"
store.put("df", df, format="table")
# some invalid terms
with pytest.raises(TypeError):
Term()
# more invalid
with pytest.raises(ValueError):
> store.select("df", "df.index[3]")
pandas/tests/io/pytables/test_store.py:2326:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
pandas/io/pytables.py:876: in select
return it.get_result()
pandas/io/pytables.py:1930: in get_result
results = self.func(self.start, self.stop, where)
pandas/io/pytables.py:860: in func
return s.read(start=_start, stop=_stop, where=_where, columns=columns)
pandas/io/pytables.py:4483: in read
result = self._read_axes(where=where, start=start, stop=stop)
pandas/io/pytables.py:3682: in _read_axes
selection = Selection(self, where=where, start=start, stop=stop)
pandas/io/pytables.py:5167: in __init__
self.terms = self.generate(where)
pandas/io/pytables.py:5180: in generate
return PyTablesExpr(where, queryables=q, encoding=self.table.encoding)
pandas/core/computation/pytables.py:573: in __init__
self.terms = self.parse()
pandas/core/computation/expr.py:806: in parse
return self._visitor.visit(self.expr)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:404: in visit_Module
return self.visit(expr, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:407: in visit_Expr
return self.visit(node.value, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/pytables.py:430: in visit_Subscript
return self.const_type(value[slobj], self.env)
pandas/core/indexes/extension.py:215: in __getitem__
result = self._data[key]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = <DatetimeArray>
['2000-01-03 00:00:00', '2000-01-04 00:00:00', '2000-01-05 00:00:00',
'2000-01-06 00:00:00', '2000-01...2-08 00:00:00',
'2000-02-09 00:00:00', '2000-02-10 00:00:00', '2000-02-11 00:00:00']
Length: 30, dtype: datetime64[ns]
key = 3
def __getitem__(self, key):
"""
This getitem defers to the underlying array, which
by-definition can
only handle list-likes, slices, and integer scalars
"""
if lib.is_integer(key):
# fast-path
result = self._data[key]
if self.ndim == 1:
return self._box_func(result)
return self._simple_new(result, dtype=self.dtype)
if com.is_bool_indexer(key):
# first convert to boolean, because check_array_indexer doesn't
# allow object dtype
if is_object_dtype(key):
key = np.asarray(key, dtype=bool)
key = check_array_indexer(self, key)
key = lib.maybe_booleans_to_slice(key.view(np.uint8))
elif isinstance(key, list) and len(key) == 1 and
isinstance(key[0], slice):
# see https://github.com/pandas-dev/pandas/issues/31299,
need to allow
# this for now (would otherwise raise in check_array_indexer)
pass
else:
key = check_array_indexer(self, key)
freq = self._get_getitem_freq(key)
> result = self._data[key]
E IndexError: only integers, slices (`:`), ellipsis (`...`),
numpy.newaxis (`None`) and integer or boolean arrays are valid indices
pandas/core/arrays/datetimelike.py:559: IndexError
____________________ TestHDFStore.test_frame_select_complex
____________________
self = <pandas.tests.io.pytables.test_store.TestHDFStore object at
0x7f75242194c0>
setup_path = 'tmp.__utBSsB3aA1__.h5'
def test_frame_select_complex(self, setup_path):
# select via complex criteria
df = tm.makeTimeDataFrame()
df["string"] = "foo"
df.loc[df.index[0:4], "string"] = "bar"
with ensure_clean_store(setup_path) as store:
store.put("df", df, format="table", data_columns=["string"])
# empty
> result = store.select("df", 'index>df.index[3] & string="bar"')
pandas/tests/io/pytables/test_store.py:3327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
pandas/io/pytables.py:876: in select
return it.get_result()
pandas/io/pytables.py:1930: in get_result
results = self.func(self.start, self.stop, where)
pandas/io/pytables.py:860: in func
return s.read(start=_start, stop=_stop, where=_where, columns=columns)
pandas/io/pytables.py:4483: in read
result = self._read_axes(where=where, start=start, stop=stop)
pandas/io/pytables.py:3682: in _read_axes
selection = Selection(self, where=where, start=start, stop=stop)
pandas/io/pytables.py:5167: in __init__
self.terms = self.generate(where)
pandas/io/pytables.py:5180: in generate
return PyTablesExpr(where, queryables=q, encoding=self.table.encoding)
pandas/core/computation/pytables.py:573: in __init__
self.terms = self.parse()
pandas/core/computation/expr.py:806: in parse
return self._visitor.visit(self.expr)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:404: in visit_Module
return self.visit(expr, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:407: in visit_Expr
return self.visit(node.value, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:726: in visit_BoolOp
return reduce(visitor, operands)
pandas/core/computation/expr.py:719: in visitor
lhs = self._try_visit_binop(x)
pandas/core/computation/expr.py:715: in _try_visit_binop
return self.visit(bop)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:699: in visit_Compare
return self.visit(binop)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:520: in visit_BinOp
op, op_class, left, right = self._maybe_transform_eq_ne(node)
pandas/core/computation/expr.py:441: in _maybe_transform_eq_ne
right = self.visit(node.right, side="right")
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/pytables.py:430: in visit_Subscript
return self.const_type(value[slobj], self.env)
pandas/core/indexes/extension.py:215: in __getitem__
result = self._data[key]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = <DatetimeArray>
['2000-01-03 00:00:00', '2000-01-04 00:00:00', '2000-01-05 00:00:00',
'2000-01-06 00:00:00', '2000-01...2-08 00:00:00',
'2000-02-09 00:00:00', '2000-02-10 00:00:00', '2000-02-11 00:00:00']
Length: 30, dtype: datetime64[ns]
key = 3
def __getitem__(self, key):
"""
This getitem defers to the underlying array, which
by-definition can
only handle list-likes, slices, and integer scalars
"""
if lib.is_integer(key):
# fast-path
result = self._data[key]
if self.ndim == 1:
return self._box_func(result)
return self._simple_new(result, dtype=self.dtype)
if com.is_bool_indexer(key):
# first convert to boolean, because check_array_indexer doesn't
# allow object dtype
if is_object_dtype(key):
key = np.asarray(key, dtype=bool)
key = check_array_indexer(self, key)
key = lib.maybe_booleans_to_slice(key.view(np.uint8))
elif isinstance(key, list) and len(key) == 1 and
isinstance(key[0], slice):
# see https://github.com/pandas-dev/pandas/issues/31299,
need to allow
# this for now (would otherwise raise in check_array_indexer)
pass
else:
key = check_array_indexer(self, key)
freq = self._get_getitem_freq(key)
> result = self._data[key]
E IndexError: only integers, slices (`:`), ellipsis (`...`),
numpy.newaxis (`None`) and integer or boolean arrays are valid indices
pandas/core/arrays/datetimelike.py:559: IndexError
_____________________ TestHDFStore.test_select_as_multiple
_____________________
self = <pandas.tests.io.pytables.test_store.TestHDFStore object at
0x7f7517854160>
setup_path = 'tmp.__W7kEAOquWg__.h5'
def test_select_as_multiple(self, setup_path):
df1 = tm.makeTimeDataFrame()
df2 = tm.makeTimeDataFrame().rename(columns="{}_2".format)
df2["foo"] = "bar"
with ensure_clean_store(setup_path) as store:
# no tables stored
with pytest.raises(Exception):
store.select_as_multiple(None, where=["A>0", "B>0"],
selector="df1")
store.append("df1", df1, data_columns=["A", "B"])
store.append("df2", df2)
# exceptions
with pytest.raises(Exception):
store.select_as_multiple(None, where=["A>0", "B>0"],
selector="df1")
with pytest.raises(Exception):
store.select_as_multiple([None], where=["A>0", "B>0"],
selector="df1")
msg = "'No object named df3 in the file'"
with pytest.raises(KeyError, match=msg):
store.select_as_multiple(
["df1", "df3"], where=["A>0", "B>0"], selector="df1"
)
with pytest.raises(KeyError, match=msg):
store.select_as_multiple(["df3"], where=["A>0", "B>0"],
selector="df1")
with pytest.raises(KeyError, match="'No object named df4 in
the file'"):
store.select_as_multiple(
["df1", "df2"], where=["A>0", "B>0"], selector="df4"
)
# default select
result = store.select("df1", ["A>0", "B>0"])
expected = store.select_as_multiple(
["df1"], where=["A>0", "B>0"], selector="df1"
)
tm.assert_frame_equal(result, expected)
expected = store.select_as_multiple(
"df1", where=["A>0", "B>0"], selector="df1"
)
tm.assert_frame_equal(result, expected)
# multiple
result = store.select_as_multiple(
["df1", "df2"], where=["A>0", "B>0"], selector="df1"
)
expected = concat([df1, df2], axis=1)
expected = expected[(expected.A > 0) & (expected.B > 0)]
tm.assert_frame_equal(result, expected)
# multiple (diff selector)
> result = store.select_as_multiple(
["df1", "df2"], where="index>df2.index[4]", selector="df2"
)
pandas/tests/io/pytables/test_store.py:3819:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
pandas/io/pytables.py:1070: in select_as_multiple
return it.get_result(coordinates=True)
pandas/io/pytables.py:1923: in get_result
where = self.s.read_coordinates(
pandas/io/pytables.py:4130: in read_coordinates
selection = Selection(self, where=where, start=start, stop=stop)
pandas/io/pytables.py:5167: in __init__
self.terms = self.generate(where)
pandas/io/pytables.py:5180: in generate
return PyTablesExpr(where, queryables=q, encoding=self.table.encoding)
pandas/core/computation/pytables.py:573: in __init__
self.terms = self.parse()
pandas/core/computation/expr.py:806: in parse
return self._visitor.visit(self.expr)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:404: in visit_Module
return self.visit(expr, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:407: in visit_Expr
return self.visit(node.value, **kwargs)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:699: in visit_Compare
return self.visit(binop)
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/expr.py:520: in visit_BinOp
op, op_class, left, right = self._maybe_transform_eq_ne(node)
pandas/core/computation/expr.py:441: in _maybe_transform_eq_ne
right = self.visit(node.right, side="right")
pandas/core/computation/expr.py:398: in visit
return visitor(node, **kwargs)
pandas/core/computation/pytables.py:430: in visit_Subscript
return self.const_type(value[slobj], self.env)
pandas/core/indexes/extension.py:215: in __getitem__
result = self._data[key]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
self = <DatetimeArray>
['2000-01-03 00:00:00', '2000-01-04 00:00:00', '2000-01-05 00:00:00',
'2000-01-06 00:00:00', '2000-01...2-08 00:00:00',
'2000-02-09 00:00:00', '2000-02-10 00:00:00', '2000-02-11 00:00:00']
Length: 30, dtype: datetime64[ns]
key = 4
def __getitem__(self, key):
"""
This getitem defers to the underlying array, which
by-definition can
only handle list-likes, slices, and integer scalars
"""
if lib.is_integer(key):
# fast-path
result = self._data[key]
if self.ndim == 1:
return self._box_func(result)
return self._simple_new(result, dtype=self.dtype)
if com.is_bool_indexer(key):
# first convert to boolean, because check_array_indexer doesn't
# allow object dtype
if is_object_dtype(key):
key = np.asarray(key, dtype=bool)
key = check_array_indexer(self, key)
key = lib.maybe_booleans_to_slice(key.view(np.uint8))
elif isinstance(key, list) and len(key) == 1 and
isinstance(key[0], slice):
# see https://github.com/pandas-dev/pandas/issues/31299,
need to allow
# this for now (would otherwise raise in check_array_indexer)
pass
else:
key = check_array_indexer(self, key)
freq = self._get_getitem_freq(key)
> result = self._data[key]
E IndexError: only integers, slices (`:`), ellipsis (`...`),
numpy.newaxis (`None`) and integer or boolean arrays are valid indices
pandas/core/arrays/datetimelike.py:559: IndexError
=============================== warnings summary
===============================
[...]
=================================== FAILURES
===================================
_______________________________ test_statsmodels
_______________________________
@tm.network
# Cython import warning
@pytest.mark.filterwarnings("ignore:pandas.util.testing is deprecated")
@pytest.mark.filterwarnings("ignore:can't:ImportWarning")
@pytest.mark.filterwarnings(
# patsy needs to update their imports
"ignore:Using or importing the ABCs from
'collections:DeprecationWarning"
)
def test_statsmodels():
statsmodels = import_module("statsmodels") # noqa
> import statsmodels.api as sm
pandas/tests/test_downstream.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
/usr/lib/python3/dist-packages/statsmodels/api.py:11: in <module>
from .regression.recursive_ls import RecursiveLS
/usr/lib/python3/dist-packages/statsmodels/regression/recursive_ls.py:14: in
<module>
from statsmodels.tsa.statespace.mlemodel import (
/usr/lib/python3/dist-packages/statsmodels/tsa/statespace/mlemodel.py:32: in
<module>
from .simulation_smoother import SimulationSmoother
/usr/lib/python3/dist-packages/statsmodels/tsa/statespace/simulation_smoother.py:9:
in <module>
from .kalman_smoother import KalmanSmoother
/usr/lib/python3/dist-packages/statsmodels/tsa/statespace/kalman_smoother.py:11:
in <module>
from statsmodels.tsa.statespace.representation import OptionWrapper
/usr/lib/python3/dist-packages/statsmodels/tsa/statespace/representation.py:9:
in <module>
from .tools import (
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
"""
Statespace Tools
Author: Chad Fulton
License: Simplified-BSD
"""
import numpy as np
from scipy.linalg import solve_sylvester
import pandas as pd
from statsmodels.compat.pandas import Appender
from statsmodels.tools.data import _is_using_pandas
from scipy.linalg.blas import find_best_blas_type
> from . import (_initialization, _representation, _kalman_filter,
_kalman_smoother, _simulation_smoother,
_cfa_simulation_smoother, _tools)
E ImportError: cannot import name '_initialization' from
'statsmodels.tsa.statespace'
(/usr/lib/python3/dist-packages/statsmodels/tsa/statespace/__init__.py)
/usr/lib/python3/dist-packages/statsmodels/tsa/statespace/tools.py:14:
ImportError
More information about the debian-science-maintainers
mailing list