ValueError Traceback (most recent call last) Cell In[82], line 12 8 andares = 1 10 entrada = [['area','garagem','banheiros','lareira','marmore','andares']] ---> 12 print('{0:.2f} reais'. format(modelo.predict(entrada)[0]))
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\linear_model_base.py:386, in LinearModel.predict(self, X) 372 def predict(self, X): 373 """ 374 Predict using the linear model. 375 (...) 384 Returns predicted values. 385 """ --> 386 return self._decision_function(X)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\linear_model_base.py:369, in LinearModel._decision_function(self, X) 366 def decision_function(self, X): 367 check_is_fitted(self) --> 369 X = self.validate_data(X, accept_sparse=["csr", "csc", "coo"], reset=False) 370 return safe_sparse_dot(X, self.coef.T, dense_output=True) + self.intercept
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\base.py:604, in BaseEstimator._validate_data(self, X, y, reset, validate_separately, cast_to_ndarray, **check_params) 602 out = X, y 603 elif not no_val_X and no_val_y: --> 604 out = check_array(X, input_name="X", **check_params) 605 elif no_val_X and not no_val_y: 606 out = _check_y(y, **check_params)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\utils\validation.py:948, in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator, input_name) 940 raise ValueError( 941 "Expected 2D array, got 1D array instead:\narray={}.\n" 942 "Reshape your data either using array.reshape(-1, 1) if " 943 "your data has a single feature or array.reshape(1, -1) " 944 "if it contains a single sample.".format(array) 945 ) 947 if dtype_numeric and hasattr(array.dtype, "kind") and array.dtype.kind in "USV": --> 948 raise ValueError( 949 "dtype='numeric' is not compatible with arrays of bytes/strings." 950 "Convert your data to numeric values explicitly instead." 951 ) 952 if not allow_nd and array.ndim >= 3: 953 raise ValueError( 954 "Found array with dim %d. %s expected <= 2." 955 % (array.ndim, estimator_name) 956 )
ValueError: dtype='numeric' is not compatible with arrays of bytes/strings.Convert your data to numeric values explicitly instead.