ValueError: axes don't match array
时间: 2024-06-06 22:07:02 浏览: 207
python3.7解决最小二乘遇到ValueError:Expected 2D array, got 1D array instead: array=[5.].关于reshape和predict
This error occurs when the number of dimensions and/or sizes of the arrays being operated on do not match. This can happen when trying to perform operations such as addition, multiplication, or concatenation on arrays with different shapes.
For example, if you have two arrays with shapes (3,4) and (4,3), you cannot add them together because their shapes do not match.
To fix this error, you should ensure that the arrays you are operating on have the same number of dimensions and the same shape. You can use functions like numpy.reshape() or numpy.transpose() to change the shape of your arrays so that they are compatible.
阅读全文