Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Blacklisted attribute within module eval

Hi

I am trying to use the eval function in DataFrame. Here with the example from pandas documentation:

from numpy.random import randn  
from pandas import DataFrame  
df = DataFrame(randn(10, 2), columns=list('ab'))  
df.eval('a + b')  
df.eval('c = a + b')  

The output says:
InputRejected: Blacklisted attribute within module eval The attributes in the eval function is just + and = and they seems to be blacklisted. I guess everything is blacklisted then.
Is there any way to unlock this, or to manually whitelist some arithmetics?

Grateful for some help.

1 response

I had a similar problem. I like the method. Wish we could use it. See this other post https://www.quantopian.com/posts/is-the-pandas-eval-method-allowed-in-algorithms.