title: Using PySpark Imputer on grouped data
body: <p>I have a <code>Class</code> column which can be 1, 2 or 3, and another column <code>Age</code> with some missing data. I want to Impute the average <code>Age</code> of each <code>Class</code> group.</p>
  
  <p>I want to do something along:</p>
  
  <pre><code>grouped_data = df.groupBy('Class')
  imputer = Imputer(inputCols=['Age'], outputCols=['imputed_Age'])
  imputer.fit(grouped_data)
  </code></pre>
  
  <p>Is there any workaround to that?</p>
  
  <p>Thanks for your time</p>