multiple criteria for aggregation on pySpark Dataframe
<p>I have a pySpark dataframe that looks like this:</p>

<pre><code>+-------------+----------+
|          sku|      date|
+-------------+----------+
|MLA-603526656|02/09/2016|
|MLA-603526656|01/09/2016|
|MLA-604172009|02/10/2016|
|MLA-605470584|02/09/2016|
|MLA-605502281|02/10/2016|
|MLA-605502281|02/09/2016|
+-------------+----------+
</code></pre>

<p>I want to group by sku, and then calculate the min and max dates. If I do this:</p>

<pre><code>df_testing.groupBy('sku') \
    .agg({'date': 'min', 'date':'max'}) \
    .limit(10) \
    .show()
</code></pre>

<p>the behavior is the same as Pandas, where I only get the <code>sku</code> and <code>max(date)</code> columns. In Pandas I would normally do the following to get the results I want:</p>

<pre><code>df_testing.groupBy('sku') \
    .agg({'day': ['min','max']}) \
    .limit(10) \
    .show()
</code></pre>

<p>However on pySpark this does not work, and I get a <code>java.util.ArrayList cannot be cast to java.lang.String</code> error. Could anyone please point me to the correct syntax?</p>

<p>Thanks.</p>