Skip to content

Conversation

@sklam
Copy link
Contributor

@sklam sklam commented Aug 31, 2015

closes #4893

Extends the eval parser to accept calling math functions.

@jreback jreback added Enhancement API Design Numeric Operations Arithmetic, Comparison, and Logical operations labels Aug 31, 2015
@jreback
Copy link
Contributor

jreback commented Sep 2, 2015

looks good. can you add a whatsnew note in 0.17.0 docs. pls squash as well. ping when green.

@jreback jreback added this to the 0.17.0 milestone Sep 2, 2015
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add the issue number here as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls move to the Enhancements section

@jreback
Copy link
Contributor

jreback commented Sep 2, 2015

once I merged this: #10975 (or you can rebase on top)

pls update the tests as you indicated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged the fix for #10952. if you'd add this test, would be great. ping when green.

@jreback
Copy link
Contributor

jreback commented Sep 4, 2015

@sklam can you update the tests

@jreback
Copy link
Contributor

jreback commented Sep 5, 2015

@sklam can you update

@jreback
Copy link
Contributor

jreback commented Sep 5, 2015

hmm, it appears numexpr automatically upcasts complex64 -> complex128?
is that a bug? or in the spec?

In [1]: df = DataFrame({'a': np.random.randn(10).astype(np.complex64)})

In [2]: df.dtypes
Out[2]: 
a    complex64
dtype: object

In [3]: df.eval('b = sin(a)')

In [4]: df
Out[4]: 
                a                     b
0  (-0.570414+0j)  (-0.539980304291+0j)
1   (0.623834+0j)   (0.584150916712+0j)
2     (1.6842+0j)   (0.993577225836-0j)
3    (1.54063+0j)   (0.999545174164+0j)
4   (0.788171+0j)   (0.709064831257+0j)
5  (-0.916847+0j)  (-0.793687403046+0j)
6   (0.775991+0j)   (0.700423483759+0j)
7  (-0.654412+0j)  (-0.608692614148+0j)
8   (-1.62652+0j)  (-0.998447583421-0j)
9   (0.152154+0j)   (0.151567580954+0j)

In [5]: df.dtypes
Out[5]: 
a     complex64
b    complex128
dtype: object

jreback added a commit that referenced this pull request Sep 5, 2015
Add support for math functions in eval()
@jreback jreback merged commit ce80793 into pandas-dev:master Sep 5, 2015
@jreback
Copy link
Contributor

jreback commented Sep 5, 2015

thanks @sklam

sinhrks added a commit that referenced this pull request Sep 14, 2015
DOC: Update "enhancing perf" doc based on #10953
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Design Enhancement Numeric Operations Arithmetic, Comparison, and Logical operations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eval - 'Call' nodes are not implemented

2 participants