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

add string support to if statement #33

Merged
merged 2 commits into from
Nov 10, 2023
Merged

add string support to if statement #33

merged 2 commits into from
Nov 10, 2023

Conversation

TimurUncountable
Copy link

I did some testing on master with an output of type TEXT_CALCULATION and a formula like if(a > 10, "b", "Cccc") for any numeric output a.

I had to change my requirements.txt on master to

git+https://github.com/uncountableinc/hotxlfp@1d83b13b69bf730446357dbd01ae61293309b84e

and reinstall the dependencies with pip to test the library.

):
then_str = np.array(then, dtype="U")
otherwise_str = np.array(otherwise, dtype="U")
return np.where(np.array(test, dtype="b"), then_str, otherwise_str)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a good strategy. I'll test to see if this np.array strategy works on our platform, but it also looks like it shouldn't cause any regressions because of the type checks you are doing.

Copy link
Collaborator

@leb2 leb2 left a comment

Choose a reason for hiding this comment

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

Changes make sense. Thanks for adding

@leb2 leb2 merged commit 4261fab into master Nov 10, 2023
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

Successfully merging this pull request may close these issues.

2 participants