# split data into its X and y components
X, y = data1.values[:,0:1], data1.values[:,1]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.50, random_state=0)
logreg = LogisticRegression()
# Fit logreg to the train set
logreg.fit(X_train,y_train)
ValueError Traceback (most recent call last)
<ipython-input-59-c70ce69fd488> in <module>
2
3 # Fit logreg to the train set
----> 4 logreg.fit(X_train,y_train)
5
~\anaconda3\lib\site-packages\sklearn\linear_model\_logistic.py in fit(self, X, y, sample_weight)
1525
1526 X, y = check_X_y(X, y, accept_sparse='csr', dtype=_dtype, order="C",
-> 1527 accept_large_sparse=solver != 'liblinear')
1528 check_classification_targets(y)
1529 self.classes_ = np.unique(y)
~\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)
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,
~\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)
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"
~\anaconda3\lib\site-packages\numpy\core\_asarray.py in asarray(a, dtype, order)
83
84 """
---> 85 return array(a, dtype, copy=False, order=order)
86
87
ValueError: could not convert string to float: 'yes'