title: Finding hour of daily max using Pandas in Python
body: <p>I am trying to find the hour of max demand every day in my demand time series.</p>
  
  <p>I have created a dataframe that looks like..</p>
  
  <pre><code>                       power
  2011-01-01 00:00:00  1015.70
  2011-01-01 01:00:00  1015.70
  2011-01-01 02:00:00  1010.30
  2011-01-01 03:00:00  1010.90
  2011-01-01 04:00:00  1021.10
  2011-01-01 05:00:00  1046.00
  2011-01-01 06:00:00  1054.60
  ...
  </code></pre>
  
  <p>and a grouped series to find the max value from each day using .max()</p>
  
  <pre><code>grouped = df.groupby(pd.TimeGrouper('D'))
  grouped['power'].max()
  </code></pre>
  
  <p>OUTPUT</p>
  
  <pre><code>2011-01-01    1367.30
  2011-01-02    1381.90
  2011-01-03    1289.00
  2011-01-04    1323.50
  2011-01-05    1372.70
  2011-01-06    1314.40
  2011-01-07    1310.60
  ...
  </code></pre>
  
  <p>However I need the hour of the max value also. So something like:</p>
  
  <pre><code>2011-01-01  18  1367.30
  2011-01-02  5   1381.90
  2011-01-03  22  1289.00
  2011-01-04  10  1323.50
  ...
  </code></pre>
  
  <p>I have tried using idxmax() but I keep getting a ValueError</p>