Getting an error 'ValueError: bad input shape (1906, 38)' when applying logistics regression model



Hello everyone,
I am trying to fit a logistics regression model in python on a data frame ‘df’. My target variable is categorical. Originally, I had 16 variables. Few of them are categorical. I created dummy variables using those categorical variables. Finally, when I run my model on data set, it popped up an error

ValueError: bad input shape (1906, 38)

can anyone help me fix it?


Python’s logistic regression cannot handle multi-label classification which I suppose is the case here. Convert your problem into a binary classification problem for eg: one vs the rest and you should be good to go.


Could you please define your dependent variable.

Is it binary ?


@NSS Thanks for the answer. It helped.


Any way other than this to handle multi class problem in Python.

I think R can handle Multi Class Problem .