Skip to content

Multiline Eval broken for local variables after first line #15342

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
stephenrauch opened this issue Feb 8, 2017 · 0 comments
Closed

Multiline Eval broken for local variables after first line #15342

stephenrauch opened this issue Feb 8, 2017 · 0 comments
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@stephenrauch
Copy link
Contributor

Problem description

As discussed here, using local variables with a multi-line eval does not work for locals not on the first line.

This:

df.eval("""c = a * @x
           d = b * @y""", inplace = True)

fails with:

error: pandas.computation.ops.UndefinedVariableError: local variable 'y' is not defined

NOTE: I will be submitting a PR shortly.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.5.1.final.0 python-bits: 32 OS: Windows OS-release: 7 machine: AMD64 processor: Intel64 Family 6 Model 69 Stepping 1, GenuineIntel byteorder: little

pandas: 0.19.2
nose: 1.3.7
pip: 8.1.2
setuptools: 18.2
Cython: None
numpy: 1.12.0
dateutil: 2.6.0
pytz: 2016.6.1

@jreback jreback added Bug Numeric Operations Arithmetic, Comparison, and Logical operations labels Feb 8, 2017
@jreback jreback added this to the 0.20.0 milestone Feb 8, 2017
@jreback jreback closed this as completed in 3c9fec3 Feb 9, 2017
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this issue Mar 21, 2017
Also fixes the code which attempted to ignore any blank lines in the
multiline expression.

closes pandas-dev#15342

Author: Stephen Rauch <[email protected]>

Closes pandas-dev#15343 from stephenrauch/multi-line-eval-with-local and squashes the following commits:

fe67ede [Stephen Rauch] BUG: GH15342 - Multiline Eval broken for local variables after first line
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

Successfully merging a pull request may close this issue.

2 participants