title: Apply MinMaxScaler on multiple columns in PySpark
body: <p>I want to apply <code>MinMaxScalar</code> of PySpark to multiple columns of PySpark data frame <code>df</code>. So far, I only know how to apply it to a single column, e.g. <code>x</code>.</p>
  
  <pre><code>from pyspark.ml.feature import MinMaxScaler
  
  pdf = pd.DataFrame({'x':range(3), 'y':[1,2,5], 'z':[100,200,1000]})
  df = spark.createDataFrame(pdf)
  
  scaler = MinMaxScaler(inputCol="x", outputCol="x")
  scalerModel = scaler.fit(df)
  scaledData = scalerModel.transform(df)
  </code></pre>
  
  <p>What if I have 100 columns? Is there any way to do min-max scaling for many columns in PySpark?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Also, how to apply <code>MinMaxScalar</code> on integer or double values? It throws the following error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: requirement failed: Column length must be of type struct&amp;lt;type:tinyint,size:int,indices:array&amp;lt;int&amp;gt;,values:array&amp;lt;double&amp;gt;&amp;gt; but was actually int.
  </code></pre>