0
$\begingroup$

Attempting to load a dataset and print out a prediction for each array, yet I keep getting an IndexError....

test_datapoints =  [
    ['Saturday', '20:20', 'Atlanta', 'no'],
    ['Monday', '20:30', 'San Diego', 'yes'],
    ['Friday', '18:25', 'San Francisco', 'yes'],
    ['Wednesday, 15:00', 'Atlanta', 'no'],
    ['Monday', '13:00', 'LA Angels', 'no'],
    ['Sunday', '14:35', 'Arizona', 'no'],
    ['Sunday', '10:20', 'Colorado', 'no'],
    ['Tuesday', '10:20', 'Florida', 'no'],
]

test_datapoints = np.array(test_datapoints)
X_encoded_test_datapoints = np.empty(test_datapoints.shape)

for i, items in enumerate(test_datapoints[0]):
    X_encoded_test_datapoints[:, i] = label_encoder[i].transform(test_datapoints[:, i])

y_pred_new = regressor.predict(X_encoded_test_datapoints)
print(y_pred_new)

| improve this question | | | | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.