[Tutor] stats.linregress Problem
Mats Wichmann
mats at wichmann.us
Fri Nov 20 13:05:55 EST 2020
On 11/20/20 10:08 AM, Stephen P. Molnar wrote:
there's really too much information missing, Python's complaint is
fairly clear:
> Traceback (most recent call last):
>
> File "/home/comp/Apps/PythonDevelopment/LinReg_2.py", line 39, in
> <module>
> slope, intercept, r_value, p_value, std_err = stats.linregress(x1, y)
>
> File
> "/home/comp/Apps/Spyder-4.2.0/Spyder-4.2.0/lib/python3.7/site-packages/scipy/stats/_stats_mstats_common.py",
> line 116, in linregress
> ssxm, ssxym, ssyxm, ssym = np.cov(x, y, bias=1).flat
>
> ValueError: too many values to unpack (expected 4)
The .flat method of NumPy arrays returns a flat iterator over an array,
which is being unpacked. iN this case np.cov().flat is returning an
interator that produces more than the four values the code line expects,
thus the unpacking error. Why that would be the case, though...
obviously "that's what the data leads the covariance function to
generate"....
More information about the Tutor
mailing list