TypeError: fit() missing 1 required positional argument: 'y' TypeError: fit() missing 1 required positional argument: 'y' python-3.x python-3.x

TypeError: fit() missing 1 required positional argument: 'y'


You forgot the parenthesis "()" in:

model = GaussianNB()


Whenever you try to initialize/ define an object of a class you must call its own constructor to create one object for you. The constructor may have parameters or none. In your case GaussianNB is a class from sklearn which has a non-parametric constructor by default.

obj_model =  GaussianNB()

So simply we do create an object with empty parenthesis which simply means default constructor.


You forgot to put () after your model, gaussianNB.Try doing this in line 6:

model = GaussianNB()

I am pretty sure it will solve the problem.