Skip to content
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

AttributeError: 'BooleanFalse' object has no attribute 'diff' #24

Open
wukan1986 opened this issue Jul 3, 2024 · 0 comments
Open

AttributeError: 'BooleanFalse' object has no attribute 'diff' #24

wukan1986 opened this issue Jul 3, 2024 · 0 comments

Comments

@wukan1986
Copy link
Owner

def _code_block_():
    cond_1 = cs_rank(-amount, False) <= 10
    filter = and_(cond_1,
                  True)

会报错

  File "D:\Users\Kan\miniconda3\envs\py311_1\Lib\site-packages\expr_codegen\tool.py", line 41, in extract
    expr = simplify(expr)
           ^^^^^^^^^^^^^^
  File "D:\Users\Kan\miniconda3\envs\py311_1\Lib\site-packages\sympy\simplify\simplify.py", line 601, in simplify
    return _eval_simplify(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Users\Kan\miniconda3\envs\py311_1\Lib\site-packages\sympy\core\relational.py", line 428, in _eval_simplify
    elif dif.equals(0):  # XXX this is expensive

..... 

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Users\Kan\miniconda3\envs\py311_1\Lib\site-packages\sympy\core\basic.py", line 1871, in _eval_derivative_n_times
    obj2 = obj._eval_derivative(s)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Users\Kan\miniconda3\envs\py311_1\Lib\site-packages\sympy\core\function.py", line 600, in _eval_derivative
    da = a.diff(s)
         ^^^^^^
AttributeError: 'BooleanFalse' object has no attribute 'diff'

其实是False) <= 10在同一行时进行simplify报错。目前没有好的办法,只能在编码时就回避,不写同一行。

def _code_block_():
    cond_1 = cs_rank(-amount, False)
    filter = and_(cond_1 <= 10,
                  True)

这样就不报错了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant