title: Pandas idxmax() doesn't work on Series grouped by time periods which contain NaNs
body: <p>I have a Series that contains scalar values indexes by days over several years. For some years there are not data.</p>
  
  <pre><code>2014-10-07    5036.883410
  2013-10-11    5007.515654
  2013-10-27    5020.184053
  2014-09-12    5082.379630
  2014-10-14    5032.669801
  2014-10-30    5033.276159
  2016-10-03    5046.921912
  2016-10-19    5141.861889
  2017-10-06    5266.138810
  </code></pre>
  
  <p>From this I want to get
  1. the maximum for each year
  2. the day of the maximum for each year
  For those years where there are not data, there should be a nan.</p>
  
  <p>To resolve 1. the following works:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  data= pd.Series( index=pd.DatetimeIndex(['2014-10-07', '2013-10-11', '2013-10-27', '2014-09-12', '2014-10-14', '2014-10-30', '2016-10-03', '2016-10-19', '2017-10-06'], dtype='datetime64[ns]', name='time', freq=None), data=np.array([5036.88341035, 5007.51565355, 5020.18405295, 5082.37963023, 5032.66980146, 5033.27615931, 5046.92191246, 5141.86188915, 5266.1388102 ]))
  
  # get maximum of each year  
  data.resample('A').max()
  </code></pre>
  
  <p>However, I tried different options to get the index of the date with the maximum, but they all failed:</p>
  
  <pre><code>data.resample('A').idxmax()
  </code></pre>
  
  <p>This raises the following Attribute error:</p>
  
  <pre><code>AttributeError: 'DatetimeIndexResampler' object has no attribute 'idxmax'
  </code></pre>
  
  <p>Then I tried the following:</p>
  
  <pre><code>data.groupby(pd.TimeGrouper('A')).idxmax()
  </code></pre>
  
  <p>but this gave an ValueError without specification.
  I then found <a href="https://stackoverflow.com/questions/31690493/idxmax-doesnt-work-on-seriesgroupby-that-contains-nan">this</a> workaround:</p>
  
  <pre><code>data.groupby(pd.TimeGrouper('A')).agg( lambda x : x.idxmax() )
  </code></pre>
  
  <p>but I did not wore either for temporally grouped data:</p>
  
  <pre><code>ValueError: attempt to get argmax of an empty sequence
  </code></pre>
  
  <p>Apparently the reported <a href="https://github.com/pandas-dev/pandas/issues/10694" rel="nofollow noreferrer">bug</a> has not been fixed yet and the suggested workaround for categorical data does not seem to work for temporally grouped/resampled data.</p>
  
  <p>Can anyone provide a suitable workaround for this case or maybe an entirely different (and efficient) solution approach to the above problem?</p>
  
  <p>Thanks in advance!</p>