Filling missing data using scikit

from sklearn.impute import SimpleImputer
We are importing the simple imputer from scikit library.
imputer = SimpleImputer(missing_values=np.nan, strategy=’mean’)
The strategy used is mean, where the missing data is replaced by average of the values.[:, 1:3])
The number of columns on which the above function is used is 2 i.e between 1 and 3.
X[:, 1:3] = imputer.transform(X[:, 1:3])
The new column is again assigned to the 2 columns.

Importing dataset in Python

dataset = [library alias name].read_csv(‘file.csv’)

x = dataset.iloc[:,:-1].values

y = dataset.iloc[:, -1].values

In the above lines, read_csv and iloc are functions.

[:,:-1] is slicing range of the values.