title: Find id of maximum value and average pyspark dataframe
body: <p>How do I find the id of maximum value of another column and average value using pyspark dataframe?</p>
  <p><code>df</code>:</p>
  <pre><code>+-------------+-------+----------+---------+----------+--------+------+------------------+
  |ChargingEvent|   CPID| StartDate|StartTime|   EndDate| EndTime|Energy|    PluginDuration|
  +-------------+-------+----------+---------+----------+--------+------+------------------+
  |     16673806|AN11719|2017-12-31| 14:46:00|2017-12-31|18:00:00|   2.4|3.2333333333333334|
  |     16670986|AN01706|2017-12-31| 11:25:00|2017-12-31|13:14:00|   6.1|1.8166666666666667|
  |      3174961|AN18584|2017-12-31| 11:26:11|2018-01-01|12:54:11|    24|25.466666666666665|
  </code></pre>
  <p>Current code:</p>
  <pre><code>df.agg({'PluginDuration': 'max'}).show()
  df.agg({'PluginDuration': 'avg'}).show()
  </code></pre>
  <p>Then rename the all of the columns to as like the expected outcome below:</p>
  <pre><code>+-------------------+-------------------+------------------+
  |id                 |max_value          |avg_value
  +-------------------+-------------------+-------------------+
  | QWER              |96.26              |12.35              |
  
  </code></pre>
  <p><code>id</code> rename from <code>CPID</code>. And <code>max_value</code> &amp; <code>avg_value</code> needs to round up to 2 decimal places.</p>