df.groupBy(color).max("count").show();
+-----------+----------+
|color |max(count)|
+-----------+----------+
| red| 5|
| blue| 3|
| brown| 2|
| green| 2|
+-----------+----------+
+-----------+----------+----------+
|color | date|max(count)|
+-----------+----------+----------+
| red|2014-05-26| 5|
| blue|2014-05-26| 3|
| brown|2014-07-31| 2|
| green|2014-08-01| 2|
+-----------+----------+----------+