Skip to content

Multiline Eval broken for local variables after first line #15342

Closed
@stephenrauch

Description

@stephenrauch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions