Skip to content

bool DataFrame arith operations error when size is large enough #4934

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
dalejung opened this issue Sep 22, 2013 · 12 comments
Closed

bool DataFrame arith operations error when size is large enough #4934

dalejung opened this issue Sep 22, 2013 · 12 comments
Labels
Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations Performance Memory or execution speed performance
Milestone

Comments

@dalejung
Copy link
Contributor

import pandas as pd
import numpy as np

N = 1000000
bools = np.random.randn(N, 1) > 0

df = pd.DataFrame(bools)

df * df
/python2.7/site-packages/numexpr/necompiler.pyc in typeCompileAst(ast)
    147                 raise NotImplementedError(
    148                     "couldn't find matching opcode for '%s'"
--> 149                     % (ast.value + '_' + retsig+basesig))
    150         # First just cast constants, then cast variables if necessary:
    151         for i, (have, want)  in enumerate(zip(basesig, sig)):

NotImplementedError: couldn't find matching opcode for 'mul_bbb'

I'm guessing there's a size trigger that throws ops to numexpr since this doesn't fail for smaller frames.

@jtratner
Copy link
Contributor

yes, that's correct. Let me see if I get the same thing.

@cpcloud
Copy link
Member

cpcloud commented Sep 22, 2013

You cannot multiply boolean arrays using numexpr...you can use & instead and | for +

@cpcloud
Copy link
Member

cpcloud commented Sep 22, 2013

numexpr has no op code for it, hence that (i guess somewhat cryptic) error message

@jtratner
Copy link
Contributor

Yeah, but don't we need to account for this?

@cpcloud
Copy link
Member

cpcloud commented Sep 22, 2013

yes....wasn't dismissing it ... was just offering an alternative for @dalejung if he is awake hacking at 1:30 AM EST and needs a quick solution

@cpcloud
Copy link
Member

cpcloud commented Sep 22, 2013

@jtratner can u put this in your arith ops refactor?

@cpcloud
Copy link
Member

cpcloud commented Sep 22, 2013

actually kind of annoying ... since u have to convert bools to ints for arith ops ... good eval test case as well

@cpcloud
Copy link
Member

cpcloud commented Sep 22, 2013

same error, shocker 😄

@jtratner
Copy link
Contributor

yeah - what should we do - just check for bool dtypes in _can_use?

On Sun, Sep 22, 2013 at 1:28 AM, Phillip Cloud [email protected]:

@jtratner https://github.com/jtratner can u put this in your arith ops
refactor?


Reply to this email directly or view it on GitHubhttps://github.com//issues/4934#issuecomment-24876373
.

@dalejung
Copy link
Contributor Author

@cpcloud No worries. Using the .values works fine.

@cpcloud
Copy link
Member

cpcloud commented Sep 22, 2013

@jtratner disallow for arith ops allow for &, |, ~

@jreback
Copy link
Contributor

jreback commented Apr 9, 2014

this was closed by #6803 (raises ``NotImplementedError)

@jreback jreback closed this as completed Apr 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations Performance Memory or execution speed performance
Projects
None yet
Development

No branches or pull requests

4 participants