Search code examples
python-3.xscikit-learnlinear-regression

Getting syntax error in code at remainder='passthrough' in below code snippet


from sklearn.compose import ColumnTransformer ct = ColumnTransformer([('encoder', OneHotEncoder(),[3]), remainder='passthrough']) x = np.array(ct.fit_transform(x), dtype = np.float)


Solution

  • The correct syntax would be as follows:

    import ColumnTransformer 
    
    ct = ColumnTransformer([('encoder', OneHotEncoder(),[3]), 
                            ],remainder='passthrough') 
    
    x = np.array(ct.fit_transform(x), dtype = np.float)