title: Dummy Encoding using Pyspark
body: <p><a href="https://i.stack.imgur.com/qptVG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qptVG.png" alt="enter image description here"></a></p>
  
  <p>I am hoping to dummy encode my categorical variables to numerical variables like shown in the image below, using Pyspark syntax. </p>
  
  <p>I read in data like this</p>
  
  <pre><code>data = sqlContext.read.csv("data.txt", sep = ";", header = "true")
  </code></pre>
  
  <p>In python I am able to encode my variables using the below code</p>
  
  <pre><code>data = pd.get_dummies(data, columns = ['Continent'])
  </code></pre>
  
  <p>However I am not sure how to do it in Pyspark. </p>
  
  <p>Any assistance would be greatly appreciated.</p>