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: numexpr eval doesn't hold column name via single column selection #10239

Closed
sinhrks opened this issue May 30, 2015 · 2 comments · Fixed by #58437
Closed

BUG: numexpr eval doesn't hold column name via single column selection #10239

sinhrks opened this issue May 30, 2015 · 2 comments · Fixed by #58437
Assignees
Labels
Bug expressions pd.eval, query

Comments

@sinhrks
Copy link
Member

sinhrks commented May 30, 2015

df = pd.DataFrame(np.random.randn(2, 3), columns=['A', 'B', 'C'])

numexpr.__version__
# '2.4'

# all resets column name
pd.eval('df.A')
#0   -0.312782
#1    1.204993
# dtype: float64

pd.eval('df["A"]')
#0   -0.312782
#1    1.204993
# dtype: float64

df.eval('A')
#0   -0.312782
#1    1.204993
# dtype: float64

# python engine looks OK
pd.eval('df["A"]', engine='python')
#0   -0.312782
#1    1.204993
# Name: A, dtype: float64

pd.eval('df.A', engine='python')
#0   -0.312782
#1    1.204993
# Name: A, dtype: float64

df.eval('A', engine='python')
#0   -0.312782
#1    1.204993
# Name: A, dtype: float64
@sinhrks sinhrks added the Bug label May 30, 2015
@sinhrks
Copy link
Member Author

sinhrks commented Jun 1, 2015

Looked this a little, and assume _align (and _align_core) must include the name in axes which the result should have. Not sure the logic can be simple...

@jbrockmendel jbrockmendel added the expressions pd.eval, query label Dec 1, 2019
@domsmrz
Copy link
Contributor

domsmrz commented Apr 25, 2024

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug expressions pd.eval, query
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants