title: E-num / get Dummies in pyspark
body: <p>I would like to create a function in <strong>PYSPARK</strong> that get Dataframe and list of parameters (codes/categorical features) and return the data frame with additional dummy columns like the categories of the features in the list
  PFA the Before and After DF:
  <a href="https://i.stack.imgur.com/ZMk1l.png" rel="noreferrer">before and After data frame- Example</a></p>
  
  <p>The code in python looks like that:</p>
  
  <pre><code>enum = ['column1','column2']
  
  for e in enum:
      print e
      temp = pd.get_dummies(data[e],drop_first=True,prefix=e)
      data = pd.concat([data,temp], axis=1)
      data.drop(e,axis=1,inplace=True)
  
  data.to_csv('enum_data.csv')
  </code></pre>