np.cov
с 2 1d массивами работает:
In [202]: np.cov(np.arange(10),np.arange(10))
Out[202]:
array([[9.16666667, 9.16666667],
[9.16666667, 9.16666667]])
Но если один из массивов object
dtype, я получаю вашу ошибку:
In [203]: np.cov(np.arange(10),np.arange(10).astype(object))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-203-db3c70a7640d> in <module>()
----> 1 np.cov(np.arange(10),np.arange(10).astype(object))
/usr/local/lib/python3.6/dist-packages/numpy/lib/function_base.py in cov(m, y, rowvar, bias, ddof, fweights, aweights)
2300 w *= aweights
2301
-> 2302 avg, w_sum = average(X, axis=1, weights=w, returned=True)
2303 w_sum = w_sum[0]
2304
/usr/local/lib/python3.6/dist-packages/numpy/lib/function_base.py in average(a, axis, weights, returned)
389
390 if returned:
--> 391 if scl.shape != avg.shape:
392 scl = np.broadcast_to(scl, avg.shape).copy()
393 return avg, scl
AttributeError: 'float' object has no attribute 'shape'