I'm trying to get the solution(W2) of a equation, which include np.cov, using python sympy.Solvers, but get a AttributeError: 'float' object has no attribute 'shape'.
Python – AttributeError: ‘float’ object has no attribute ‘shape’
covariancenumpypythonsympy
Related Question
- Python – Getting the class name of an instance
- Python – Convert bytes to a string
- Python – How to know if an object has an attribute in Python
- Python – How to make function decorators and chain them together
- Python – Proper way to declare custom exceptions in modern Python
- Python – How to read from stdin
- Python – How to parse XML and count instances of a particular node attribute
- Python – Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3
Best Solution
np.cov
with 2 1d arrays works:But if one of the arrays is
object
dtype, I get your error: