I tried to run regression using
1'. When I ran the code, I received the following error:
Please, do help me.
Thank you in advance
I also tried to convert the address column to float but it converted the whole column to NAN, rendering the whole process useless
regr = linear_model.LinearRegression() regr.fit(X, y)My data contains columns with DateTime format and another with physical address, such as '8300 4 AVENUE
1'. When I ran the code, I received the following error:
ValueError Traceback (most recent call last) <ipython-input-119-8a11d5d4a70e> in <module> 1 regr = linear_model.LinearRegression() ----> 2 regr.fit(X, y) ~\New\Anaconda3\lib\site-packages\sklearn\linear_model\base.py in fit(self, X, y, sample_weight) 456 n_jobs_ = self.n_jobs 457 X, y = check_X_y(X, y, accept_sparse=['csr', 'csc', 'coo'], --> 458 y_numeric=True, multi_output=True) 459 460 if sample_weight is not None and np.atleast_1d(sample_weight).ndim > 1: ~\New\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_X_y(X, y, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, multi_output, ensure_min_samples, ensure_min_features, y_numeric, warn_on_dtype, estimator) 754 ensure_min_features=ensure_min_features, 755 warn_on_dtype=warn_on_dtype, --> 756 estimator=estimator) 757 if multi_output: 758 y = check_array(y, 'csr', force_all_finite=True, ensure_2d=False, ~\New\Anaconda3\lib\site-packages\sklearn\utils\validation.py 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, warn_on_dtype, estimator) 565 # make sure we actually converted to numeric: 566 if dtype_numeric and array.dtype.kind == "O": --> 567 array = array.astype(np.float64) 568 if not allow_nd and array.ndim >= 3: 569 raise ValueError("Found array with dim %d. %s expected <= 2." ValueError: could not convert string to float: '4 AVENUE'I decided to drop the datetime column at this stage but I need the address column for my analysis.
Please, do help me.
Thank you in advance
I also tried to convert the address column to float but it converted the whole column to NAN, rendering the whole process useless