Skip to content
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

BUG: pd.eval against single element array using numexpr engine coerces to scalar #10546

Closed
sinhrks opened this issue Jul 11, 2015 · 0 comments
Closed
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@sinhrks
Copy link
Member

sinhrks commented Jul 11, 2015

import pandas as pd

# scalar (OK)
s = 1
pd.eval('s', engine='numexpr')
# 1L
pd.eval('s', engine='python')
#1

# array
a = np.array([1])

# OK
pd.eval('a', engine='python')
# array([1])

# NG
pd.eval('a', engine='numexpr')
# 1L

Internally, we can distinguish them using returned shape.

import numexpr as ne
ne.evaluate('s')
# array(1L)
ne.evaluate('a')
# array([1])
ne.evaluate('s').shape
# ()
ne.evaluate('a').shape
# (1,)
@sinhrks sinhrks added Bug Numeric Operations Arithmetic, Comparison, and Logical operations labels Jul 11, 2015
@sinhrks sinhrks added this to the 0.17.0 milestone Jul 11, 2015
@sinhrks sinhrks changed the title BUG: pd.eval against 1d array using numexpr engine coerces to scalar BUG: pd.eval against single element array using numexpr engine coerces to scalar Jul 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

No branches or pull requests

1 participant