Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

First code snippet:

imp.fit_transform(dataset['Age'].values.reshape(-1,1))

dataset['Age'] = dataset['Age'].values.reshape(-1,1)

Second code snippet:

imp.fit(dataset['Age'].values.reshape(-1, 1))

dataset['Age'] = imp.transform(dataset['Age'].values.reshape(-1, 1))

The first code snippet does not make any change to the age column of my dataset.

1 Answer

0 votes
by (41.4k points)

The correct implementation of the first piece of code would be :

dataset['Age'] = imp.fit_transform(dataset['Age'].values.reshape(-1,1))

If you wish to learn Data Science then visit this Data Science Course.

Browse Categories

...