close

[Solved] TypeError: fit_transform() missing 1 required positional argument: ‘X’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TypeError: fit_transform() missing 1 required positional argument: ‘X’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: fit_transform() missing 1 required positional argument: ‘X’ Error Occurs?

Today I get the following error TypeError: fit_transform() missing 1 required positional argument: ‘X’ in python.

How To Solve TypeError: fit_transform() missing 1 required positional argument: ‘X’ Error ?

  1. How To Solve TypeError: fit_transform() missing 1 required positional argument: 'X' Error ?

    To Solve TypeError: fit_transform() missing 1 required positional argument: 'X' Error You are assigning sc_X a reference to the StandardScaler class. but fit_transform() is is not a class method, but an instance method. This means that you have to create an instance of the class.

  2. TypeError: fit_transform() missing 1 required positional argument: 'X'

    To Solve TypeError: fit_transform() missing 1 required positional argument: 'X' Error You are assigning sc_X a reference to the StandardScaler class. but fit_transform() is is not a class method, but an instance method. This means that you have to create an instance of the class.

Solution 1

You are assigning sc_X a reference to the StandardScaler class. but fit_transform() is is not a class method, but an instance method. This means that you have to create an instance of the class.

So,

sc_X = StandardScaler

should be:

sc_X = StandardScaler()

Solution 2

You need to create the class instance :

sc_X = StandardScaler() 

as fit_transform() is instance method not a class method

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read