Closed
Description
Maybe eval is producing a strange object or something? Or it could be unrelated.
../pandas/core/index.py:898: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
result.sort()
../python2.7/site-packages/numpy/core/fromnumeric.py:595: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
a.sort(axis, kind, order)
You can see this manifest in a weird sorting difference between numexpr and the flex add method (and this generates the RuntimeWarning shown above).
import numpy as np
import pandas as pd
engine = 'numexpr'
parser = 'pandas'
r_idx_type, c_idx_type, index_name = ('i', 'dt', 'index')
from pandas.util.testing import makeCustomDataframe as mkdf
f = lambda *args, **kwargs: np.random.randn()
df = mkdf(10, 7, data_gen_f=f, r_idx_type=r_idx_type,
c_idx_type=c_idx_type)
index = getattr(df, index_name)
s = pd.Series(np.random.randn(5), index[:5])
res = pd.eval('s + df', engine=engine, parser=parser)
expected = df.add(s)
print(res.columns)
print(expected.columns)
print(res)
print(df.add(s))
Somehow they end up with columns in different orders.
Index([1, 2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00, 2, 4, 3, 0, 2000-01-06 00:00:00, 2000-01-07 00:00:00, 2000-01-10 00:00:00, 2000-01-11 00:00:00], dtype=object)
Index([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-07 00:00:00, 2000-01-10 00:00:00, 2000-01-11 00:00:00, 0, 1, 2, 3, 4], dtype=object)