Я пытаюсь получить вывод, используя то же самое следующее выражение, но не могу получить детали. Может кто-нибудь, пожалуйста, помогите?
# Separate into feature set and target variable
#FTR = Full Time Result (H=Home Win, D=Draw, A=Away Win)
import pandas as pd
import numpy as np
import xgboost as xgb
import sklearn as s
import matplotlib
import tensorflow as tf
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from IPython.display import display
df = pd.read_csv("C:/Users/patel/Desktop/tap.csv")
from IPython.display import display
X_all = df.drop(['FTR'],1)
y_all = df['FTR']
# Standardising the data.
from sklearn.preprocessing import scale
#Center to the mean and component wise scale to unit variance.
cols = [['FTHG','FTAG','HTHG','HTAG','HTR']]
for col in cols:
X_all[col] = scale(X_all[col])
ValueError Traceback (most recent call last)
<ipython-input-4-fa9f01c17527> in <module>
24 cols = [['FTHG','FTAG','HTHG','HTAG','HTR']]
25 for col in cols:
---> 26 X_all[col] = scale(X_all[col])
~\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py in scale(X, axis, with_mean, with_std, copy)
143 X = check_array(X, accept_sparse='csc', copy=copy, ensure_2d=False,
144 warn_on_dtype=True, estimator='the scale function',
--> 145 dtype=FLOAT_DTYPES, force_all_finite='allow-nan')
146 if sparse.issparse(X):
147 if with_mean:
~\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)
525 try:
526 warnings.simplefilter('error', ComplexWarning)
--> 527 array = np.asarray(array, dtype=dtype, order=order)
528 except ComplexWarning:
529 raise ValueError("Complex data not supported\n"
~\Anaconda3\lib\site-packages\numpy\core\numeric.py in asarray(a, dtype, order)
499
500 """
--> 501 return array(a, dtype, copy=False, order=order)
502
503
ValueError: не удалось преобразовать строку в число с плавающей точкой: 'D'