'Data must be 1-dimensional

enter image description here

enter image description here

enter image description here



Solution 1:[1]

The size of the arrays for test and pred should be the same, convert actual and predicted arrays to dataframes and concat:

y_test = pd.DataFrame(y_test, columns=['Actual'])
y_pred = pd.DataFrame(pred, columns=['Predicted']
pred_data = pd.DataFrame()
pred_data = pd.concat([y_test, y_pred], axis=1) #axis=1 to join columns.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Deepak