Multiline Eval broken for local variables after first line #15342

Closed
stephenrauch opened this Issue Feb 8, 2017 · 0 comments

Comments

Projects
None yet
2 participants
Contributor

stephenrauch commented Feb 8, 2017

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 added this to the 0.20.0 milestone Feb 8, 2017

jreback closed this in 3c9fec3 Feb 9, 2017

@AnkurDedania AnkurDedania added a commit to AnkurDedania/pandas that referenced this issue Mar 21, 2017

@stephenrauch @AnkurDedania stephenrauch + AnkurDedania BUG: Multiline Eval broken for local variables after first line
Also fixes the code which attempted to ignore any blank lines in the
multiline expression.

closes #15342

Author: Stephen Rauch <stephen.rauch+github@gmail.com>

Closes #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
e5a58f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment