Local test failure pandas.tests.frame.test_analytics
See original GitHub issueRunning
pytest -q --cache-clear pandas/tests/frame/test_analytics.py
Yield the following error:
___________________________ TestDataFrameAnalytics.test_mean_mixed_string_decimal ____________________________
TypeError: unsupported operand type(s) for +: 'int' and 'str'
The above exception was the direct cause of the following exception:
self = Decimal('3351.00'), other = Decimal('572.00'), context = None
def __add__(self, other, context=None):
"""Returns self + other.
-INF + INF (or the reverse) cause InvalidOperation errors.
"""
> other = _convert_other(other)
/usr/lib/python3.8/_pydecimal.py:1158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
other = Decimal('572.00'), raiseit = False, allow_float = False
def _convert_other(other, raiseit=False, allow_float=False):
"""Convert other to Decimal.
Verifies that it's ok to use in an implicit construction.
If allow_float is true, allow conversion from float; this
is used in the comparison methods (__eq__ and friends).
"""
> if isinstance(other, Decimal):
E SystemError: <built-in function isinstance> returned a result with an error set
/usr/lib/python3.8/_pydecimal.py:6017: SystemError
The above exception was the direct cause of the following exception:
self = Decimal('3351.00'), other = Decimal('609.00'), context = None
def __add__(self, other, context=None):
"""Returns self + other.
-INF + INF (or the reverse) cause InvalidOperation errors.
"""
> other = _convert_other(other)
/usr/lib/python3.8/_pydecimal.py:1158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
other = Decimal('609.00'), raiseit = False, allow_float = False
def _convert_other(other, raiseit=False, allow_float=False):
"""Convert other to Decimal.
Verifies that it's ok to use in an implicit construction.
If allow_float is true, allow conversion from float; this
is used in the comparison methods (__eq__ and friends).
"""
> if isinstance(other, Decimal):
E SystemError: <built-in function isinstance> returned a result with an error set
/usr/lib/python3.8/_pydecimal.py:6017: SystemError
The above exception was the direct cause of the following exception:
self = Decimal('3351.00'), other = Decimal('820.00'), context = None
def __add__(self, other, context=None):
"""Returns self + other.
-INF + INF (or the reverse) cause InvalidOperation errors.
"""
> other = _convert_other(other)
/usr/lib/python3.8/_pydecimal.py:1158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
other = Decimal('820.00'), raiseit = False, allow_float = False
def _convert_other(other, raiseit=False, allow_float=False):
"""Convert other to Decimal.
Verifies that it's ok to use in an implicit construction.
If allow_float is true, allow conversion from float; this
is used in the comparison methods (__eq__ and friends).
"""
> if isinstance(other, Decimal):
E SystemError: <built-in function isinstance> returned a result with an error set
/usr/lib/python3.8/_pydecimal.py:6017: SystemError
The above exception was the direct cause of the following exception:
self = <pandas.tests.frame.test_analytics.TestDataFrameAnalytics object at 0x612b1fcb3700>
def test_mean_mixed_string_decimal(self):
# GH 11670
# possible bug when calculating mean of DataFrame?
d = [
{"A": 2, "B": None, "C": Decimal("628.00")},
{"A": 1, "B": None, "C": Decimal("383.00")},
{"A": 3, "B": None, "C": Decimal("651.00")},
{"A": 2, "B": None, "C": Decimal("575.00")},
{"A": 4, "B": None, "C": Decimal("1114.00")},
{"A": 1, "B": "TEST", "C": Decimal("241.00")},
{"A": 2, "B": None, "C": Decimal("572.00")},
{"A": 4, "B": None, "C": Decimal("609.00")},
{"A": 3, "B": None, "C": Decimal("820.00")},
{"A": 5, "B": None, "C": Decimal("1223.00")},
]
df = pd.DataFrame(d)
> result = df.mean()
pandas/tests/frame/test_analytics.py:499:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/core/generic.py:11039: in stat_func
return self._reduce(
pandas/core/frame.py:7876: in _reduce
result = f(values)
pandas/core/frame.py:7828: in f
return op(x, axis=axis, skipna=skipna, **kwds)
pandas/core/nanops.py:127: in f
result = alt(values, axis=axis, skipna=skipna, **kwds)
pandas/core/nanops.py:560: in nanmean
the_sum = _ensure_numeric(values.sum(axis, dtype=dtype_sum))
../../Venvs/venv-pandas/lib/python3.8/site-packages/numpy/core/_methods.py:38: in _sum
return umr_sum(a, axis, dtype, out, keepdims, initial, where)
/usr/lib/python3.8/_pydecimal.py:1158: in __add__
other = _convert_other(other)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
other = Decimal('1223.00'), raiseit = False, allow_float = False
def _convert_other(other, raiseit=False, allow_float=False):
"""Convert other to Decimal.
Verifies that it's ok to use in an implicit construction.
If allow_float is true, allow conversion from float; this
is used in the comparison methods (__eq__ and friends).
"""
> if isinstance(other, Decimal):
E SystemError: <built-in function isinstance> returned a result with an error set
/usr/lib/python3.8/_pydecimal.py:6017: SystemError
1 failed, 90 passed, 1 xfailed in 1.89s
Output of pd.show_versions()
:
INSTALLED VERSIONS
commit : f6b3e82b5514da97b48918c99bd28a07b754291b python : 3.8.1.final.0 python-bits : 64 OS : Linux OS-release : 5.4.23.a-1-hardened Version : #1 SMP PREEMPT Sun, 01 Mar 2020 18:23:23 +0000 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8
pandas : 1.1.0.dev0+696.gf6b3e82b5 numpy : 1.18.1 pytz : 2019.3 dateutil : 2.8.1 pip : 20.0.2 setuptools : 45.2.0 Cython : 0.29.15 pytest : 5.3.5 hypothesis : 5.6.0 sphinx : 2.4.4 blosc : 1.8.3 feather : None xlsxwriter : 1.2.8 lxml.etree : 4.5.0 html5lib : 1.0.1 pymysql : None psycopg2 : None jinja2 : 2.11.1 IPython : 7.13.0 pandas_datareader: None bs4 : 4.8.2 bottleneck : 1.3.2 fastparquet : 0.3.3 gcsfs : None matplotlib : 3.2.0 numexpr : 2.7.1 odfpy : None openpyxl : 3.0.1 pandas_gbq : None pyarrow : 0.16.0 pytables : None pyxlsb : None s3fs : 0.4.0 scipy : 1.4.1 sqlalchemy : 1.3.13 tables : 3.6.1 tabulate : 0.8.6 xarray : 0.15.0 xlrd : 1.2.0 xlwt : 1.3.0 numba : 0.48.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
I ran the following before posting this issue
Happy to reopen if this issue if this still persists.