title: PySpark create new column with mapping from a dict
body: <p>Using Spark 1.6, I have a Spark <code>DataFrame column</code> (named let's say <code>col1</code>) with values A, B, C, DS, DNS, E, F, G and H. I want to create a new column (say <code>col2</code>) with the values from the <code>dict</code> here below. How do I map this? (e,g. 'A' needs to be mapped to 'S' etc.)</p>
  <pre class="lang-py prettyprint-override"><code>dict = {'A': 'S', 'B': 'S', 'C': 'S', 'DS': 'S', 'DNS': 'S', 'E': 'NS', 'F': 'NS', 'G': 'NS', 'H': 'NS'}
  </code></pre>