Bug in Anaconda Code for Excel 365?

I am running Excel 365 (installed locally) on Win11 Pro. I have created the following UDF with Anaconda Code and compare its output with Excel’s built-in formula

With Excel formula

=NORM.S.DIST(1, TRUE) 
0.84134475

With Anaconda Code

from scipy.stats import norm

@UDF(name='my_test1', nested=False)
def my_test1(x) -> float:
    return norm.cdf(x)
    
@UDF(name='my_test2', nested=False)
def my_test2(x) -> float:
    return float(norm.cdf(x))

I expect my_test1() to return a numeric value, but it returns a text instead.
I had to manually cast the output to a numeric value using the float() function as shown in my_test2(). This seems like a bug, right?

Output in Excel

This does appear to be a bug in handling numpy scalar types with UDFs. We will work on a fix.

Thank you for reporting it. Until the fix is ready, wrapping the return in float() works and will continue to work after the fix, so that is the best approach for now.

1 Like

@Scoodood Give it a try now. The fix is deployed.