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

IF condition operator returns the list of values instead of a single value #147

Open
binarycat0 opened this issue Jul 23, 2024 · 0 comments

Comments

@binarycat0
Copy link

Describe the bug
If the true_result or the false_result contains a list type value, the IF condition operator returns the list of values instead of a single value.
The number of elements depends on the length of the list.

To Reproduce

import formulas
parser = formulas.Parser()
func = parser.ast('=IF(A1, A2, A3)')[1].compile()

func(True, 1, [1,2,3])  # result is Array([1, 1, 1], dtype=object)
func(False, 1, [1,2,3])  # result is Array([1, 2, 3], dtype=object)

func(True, [1,2,3], 1)  # result is Array([1, 2, 3], dtype=object)
func(False, [1,2,3], 1)  # result is Array([1, 1, 1], dtype=object)

Expected behavior
return single value instead of list

Screenshots
If applicable, add screenshots to help explain your problem.

  • OS: [macos Sonoma 14.2.1]
  • Module Version [1.2.7]
  • Python Version [Python 3.11.9 (main, Apr 26 2024, 16:32:48) [Clang 13.0.0 (clang-1300.0.29.3)]]
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