Looking for an answer to the same error got me here, just that in my case I was using a bit more complex input (masked arrays, detailed ahead). I'm posting my solution here in case someone might need it.
In case of Masked Arrays (SciPy: Masked arrays), SciPy have a set of statistical function designated for them: scipy.stats.mstats.
For example, a couple of lists of arrays would yield the same error when called by scipy.stats.linregress:
from scipy import stats
x = [array([4.04]), array([4.38])]
y = [array([3.60]), array([4.03])]
slope, intercept, r_value, std_err = scipy.stats.linregress(x,y)
Traceback (most recent call last):
File "code.py", line 4, in <module>
slope, intercept, r, prob, sterrest = stats.linregress(x,y)
File ".../anaconda/lib/python3.4/site-packages/scipy/stats/_stats_mstats_common.py", line 79, in linregress
ssxm, ssxym, ssyxm, ssym = np.cov(x, y, bias=1).flat
ValueError: too many values to unpack (expected 4)
But using stats.mstats.linregress() would fix it:
from scipy import stats
x = [array([4.04]), array([4.38])]
y = [array([3.60]), array([4.03])]
slope, intercept, r_value, std_err = scipy.stats.mstats.linregress(x,y)
print(r**2)
>>> 1.0
p_valuein your return tuple: docs.scipy.org/doc/scipy-0.16.0/reference/generated/… - tzaman