0
**from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train[:,5:7] = sc.fit_transform(X_train[:,5:7])**

Here I want to select 5th, 6th and 9th columns.

Is there a way to select the 9th column here??

Vaibhav Yalla
  • 35
  • 1
  • 4

1 Answers1

0

In order to select 5th,6th and 9th columns, you can use .iloc. Note the column index starts from 0. So, the indices of 5,6, and 9th columns are 4,5 and 8.

    from sklearn.preprocessing import StandardScaler
    sc = StandardScaler()
    X_train.iloc[:, [4,5,8]] = sc.fit_transform(X_train.iloc[:, [4,5,8]])
Prashanth
  • 1
  • 1