<div dir="ltr"><div>Hi everyone, </div><div>first post here. I have a doubt about broadcasting in scipy. </div><div><br></div>I'm trying to apply broadcasting with hypergeom. The problem is that while hypergeom.pmf() accept my arrays without complaining the hypergeom.cdf() function throws out this error: <div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;margin-top:0px;margin-bottom:16px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-radius:3px;color:rgb(36,41,46)"><code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0px;margin:0px;background:transparent;border-radius:3px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;word-wrap:normal">TypeError: only length-1 arrays can be converted to Python scalars</code></pre></div><div>Now, I don't know if this is the expected behavior of the function, but from the documentation it doesn't seem necessary to take particular care to arrays argument in the hypergeom.cdf() function with respect to hypergeom.pmf(). Is that right or have I missed something? </div><div><br></div><div>I'm attaching a minimal example to reproduce the error, I'm using Python2.7 through Anaconda with scipy and numpy updated to the last releases.</div><div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;margin-top:0px;margin-bottom:16px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-radius:3px;color:rgb(36,41,46)"><code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0px;margin:0px;background:transparent;border-radius:3px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;word-wrap:normal">import numpy as np
from scipy.stats import hypergeom

# this works
x = np.array([[1,2,3],[4,5,6],[11,12,13]])
M,n,N = [20,7,12]
hypergeom.pmf(x,M,n,N)
hypergeom.cdf(x,M,n,N)

# this works
M=np.array([25])
n=np.array([3,6,9])
N=np.array([2,4,6])
hypergeom.pmf(x,M,n,N)

# this doesn't work
hypergeom.cdf(x,M,n,N)</code></pre></div><div><br></div><div>Thanks a lot for the support.,<br></div><div>Giovanni</div><div><br></div></div>