Hi i need your help with this mistake:
ValueError: Expected 2D array, got 1D array instead:
array=[0. 0. 0. ... 0. 0. 1.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
The code are:
train, test = train_test_split(dataset_ordenado, test_size = 0.30, random_state = 20201122)
Objetivo_train=train['results']
Objetivo_test=test['results']
Indep_train=train.drop(['results'],axis=1)
Indep_test=test.drop(['results'],axis=1)
TS = TimeSeriesSplit(n_splits = 5)
dt = DecisionTreeClassifier()
grid = {'max_depth': [5,7,9,11,15], 'min_samples_leaf': [5,7,9,11,13],'criterion': ['gini', 'entropy']}
gs = GridSearchCV(dt, param_grid=grid, cv=TS)
gs.fit(Objetivo_train, Indep_train)