Skip to main content

Sklearn predict with featuren names

I am having the same issue as this question That is I am getting the warning

UserWarning: X does not have valid feature names, but LogisticRegression was fitted with feature names

when passing a numpy array to model.predict after having passed a pandas dataframe to model.fit However I would prefer to add the feature names to the numpy array instead of training without them

What is the easies way of doing it? Ideally without transforming the numpy array to be predicted into a pandas dataframe which I think would be an overkill



source https://stackoverflow.com/questions/71945760/sklearn-predict-with-featuren-names

Comments