title: Create DataFrame grouping columns in map type
body: <p>My <strong>DataFrame</strong> has the following structure:</p>
  <pre class="lang-py prettyprint-override"><code>df = spark.createDataFrame(
      [('B', 'a', 10),
       ('B', 'b', 20),
       ('C', 'c', 30)],
      ['Brand', 'Type', 'Amount'])
  df.show()
  # +-----+----+------+
  # |Brand|Type|Amount|
  # +-----+----+------+
  # |    B|   a|    10|
  # |    B|   b|    20|
  # |    C|   c|    30|
  # +-----+----+------+
  </code></pre>
  <p>I want to reduce the amount of rows by grouping <code>type</code> and <code>amount</code> into one single column of <em>type</em>: <code>Map</code>.
  So <code>Brand</code> will be unique and <code>MAP_type_AMOUNT</code> will have <code>key,value</code> for each <code>type</code> <code>amount</code> combination.</p>
  <p>I think, spark.sql might have some functions to do it, or do I have to use RDD and make my &quot;own&quot; conversion to map type?</p>
  <p><strong>Expected output</strong>:</p>
  <pre class="lang-none prettyprint-override"><code>---------------------------
  | Brand | MAP_type_AMOUNT |
  ---------------------------
  |  B    |  {a: 10, b:20}  |
  |  C    |  {c: 30}        |
  ---------------------------
  </code></pre>