End to End Project - Bikes Assessment - Basic - Train and Analyze the Models - Train Linear Regression Model

I did not understand.

Really frustrated.

lin_reg=LinearRegression()

lin_reg.fit(trainingCols,trainingLabels)
scores=cross_val_score(trainingCols,trainingLabels,scoring=“neg_mean_absolute_error”,cv=10)

ValueError Traceback (most recent call last)
in
----> 1 lin_reg.fit(trainingCols,trainingLabels)
2 scores=cross_val_score(trainingCols,trainingLabels,scoring=“neg_mean_absolute_error”,cv=10)

/usr/local/anaconda/lib/python3.6/site-packages/sklearn/linear_model/base.py in fit(self, X, y, sample_weight)
490 n_jobs
= self.n_jobs
491 X, y = check_X_y(X, y, accept_sparse=[‘csr’, ‘csc’, ‘coo’],
–> 492 y_numeric=True, multi_output=True)
493
494 if sample_weight is not None:

/usr/local/anaconda/lib/python3.6/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)
753 ensure_min_features=ensure_min_features,
754 warn_on_dtype=warn_on_dtype,
–> 755 estimator=estimator)
756 if multi_output:
757 y = check_array(y, ‘csr’, force_all_finite=True, ensure_2d=False,

/usr/local/anaconda/lib/python3.6/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)
529 array = array.astype(dtype, casting=“unsafe”, copy=False)
530 else:
–> 531 array = np.asarray(array, order=order, dtype=dtype)
532 except ComplexWarning:
533 raise ValueError(“Complex data not supported\n”

/usr/local/anaconda/lib/python3.6/site-packages/numpy/core/numeric.py in asarray(a, dtype, order)
536
537 “”"
–> 538 return array(a, dtype, copy=False, order=order)
539
540

ValueError: could not convert string to float: ‘2012-05-23’



How can i fix it??

Pleas reply.

Hi, please take a hint or look at the answer if you are stuck. You can go through the steps from the below link which for further debugging steps: