Skip to content

BUG: Running pandas/computation/test_eval individually generates RuntimeWarnings about tp_compare #5039

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

Closed
jtratner opened this issue Sep 29, 2013 · 7 comments · Fixed by #5266
Labels
Testing pandas testing functions or related to the test suite
Milestone

Comments

@jtratner
Copy link
Contributor

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)
@jtratner
Copy link
Contributor Author

cc @cpcloud

@jreback
Copy link
Contributor

jreback commented Oct 11, 2013

@jtratner @cpcloud ? push to 0.14?

@jtratner
Copy link
Contributor Author

We probably should fix this now. It's because there are non-comparable
objects being sorted/compared in numpy. If it's in a test that's checking
for that to error out, we should wrap in a catch_warnings. If it's not
erroring it ought to. I'll try to isolate the tests for this.

@jreback
Copy link
Contributor

jreback commented Oct 14, 2013

@cpcloud ?

1 similar comment
@jreback
Copy link
Contributor

jreback commented Oct 16, 2013

@cpcloud ?

@cpcloud
Copy link
Member

cpcloud commented Oct 16, 2013

weekend :)

@jtratner
Copy link
Contributor Author

Pushing to 0.14, it's experimental/edge case regardless.

@jreback jreback modified the milestones: 0.15.0, 0.14.0 Apr 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
3 participants