ValueError: y should be a 1d array, got an array of shape (1045, 5) instead I have just started Python and working on training models. The task that I have been assigned is to train a dataset named &quot;austin_Weather&quot;
Original Dataset
y attribute
After having done some manipulations (following the article), these are my new datasets for training and testing,
X Train
y Train
Now, I tried to apply Naive-Baysen algorithm on these two datasets, but I got this following error
ValueError: y should be a 1d array, got an array of shape (1045, 5) instead.

So, I tried searching it up online, and I found one solution that I should reshape these arrays, so I tried the following code,
X_train = X_train.reshape(-1, 1)
y_train = y_train.reshape(-1, 1)
X_test = X_test.reshape(-1, 1)
y_test = y_test.reshape(-1, 1)

But I got this error on this,
AttributeError: 'DataFrame' object has no attribute 'reshape'

I tried to fix it up by searching it up online, but I couldn't understand most of the things due to my lack of knowledge in Python syntax. If anyone can help resolve this and tell me what exactly is the problem here, I would be very thankful.
Your data is multilabel: each row can have more than one label. But sklearn's Naive Bayes doesn't support that format of problem. You can use MultiOutputClassifier to wrap the Naive Bayes classifier, effectively training one model for each of the labels.
See the User Guide, especially the MultiOutput classification section. You may also want to consider the ClassifierChain (in the next section).

The last error you see is because you're using pandas structures, but reshape is a numpy method. Anyway, as @Oxbowerce observed, reshaping won't help; you need to deal with having multiple labels.