Applying a robust scaler to column 0 to 6 of my data frame?
Check out the documentation for sklearn's columnTransformer. This allows you to apply transformations to specific column indices in your dataframe.
Note the 'passthrough' option for the transformer parameter - this will be needed for the columns that you do not wish to scale/modify.
Example taken from the documentation:
&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; from sklearn.compose import ColumnTransformer
&gt;&gt;&gt; from sklearn.preprocessing import Normalizer
&gt;&gt;&gt; ct = ColumnTransformer(
...     [(&quot;norm1&quot;, Normalizer(norm='l1'), [0, 1]),
...      (&quot;norm2&quot;, Normalizer(norm='l1'), slice(2, 4))])
&gt;&gt;&gt; X = np.array([[0., 1., 2., 2.],
...               [1., 1., 0., 1.]])
&gt;&gt;&gt; # Normalizer scales each row of X to unit norm. A separate scaling
&gt;&gt;&gt; # is applied for the two first and two last elements of each
&gt;&gt;&gt; # row independently.
&gt;&gt;&gt; ct.fit_transform(X)
array([[0. , 1. , 0.5, 0.5],
       [0.5, 0.5, 0. , 1. ]])