title: Apply multiple StandardScaler's to individual groups?
body: <p>Is there a pythonic way to chain together sklearn's StandardScaler instances to independently scale data with groups? I.e., if I wanted to find independently scale  the features of the iris dataset; I could use the following code:</p>
  
  <pre class="lang-py prettyprint-override"><code>from sklearn.datasets import load_iris
  data = load_iris()
  df = pd.DataFrame(data['data'], columns=data['feature_names'])
  df['class'] = data['target']
  
  means = df.groupby('class').mean()
  stds = df.groupby('class').std()
  
  df_rescaled = (
      (df.drop(['class'], 1) - means.reindex(df['class']).values) / 
       stds.reindex(df['class']).values)
  </code></pre>
  
  <p>Here, I'm subtracting by the mean and dividing by the stdev of each group independently. But Its somewhat hard to carry around these means and stdev's, and essentially, replicate the behavior of <code>StandardScaler</code> when I have a categorical variable I'd like to control for.</p>
  
  <p>Is there a more pythonic / sklearn-friendly way to implement this type of scaling? </p>