Count unique dates in pandas dataframe
<p>I have a dataframe of surface weather observations (<code>fzraHrObs</code>) organized by a station identifier code and date. <code>fzraHrObs</code> has several columns of weather data. The station code and date (datetime objects) look like:</p>

<pre><code>usaf      dat
716270    2014-11-23 12:00:00
          2015-12-20 08:00:00
          2015-12-20 09:00:00
          2015-12-21 04:00:00
          2015-12-28 03:00:00
716280    2015-12-19 08:00:00
          2015-12-19 08:00:00
</code></pre>

<p>I would like to get a count of the number of unique <em>dates (days) per year</em> for each station - i.e. the number of days of obs per year at each station. In my example above this would give me:</p>

<pre><code>    usaf      Year     Count
    716270    2014     1
              2015     3
    716280    2014     0
              2015     1
</code></pre>

<p>I've tried using groupby and grouping by station, year, and date:
<code>grouped = fzraHrObs['dat'].groupby(fzraHrObs['usaf'], fzraHrObs.dat.dt.year, fzraHrObs.dat.dt.date])</code></p>

<p>Count, size, nunique, etc. on this just gives me the number of obs on each date, not the number of dates themselves per year. Any suggestions on getting what I want here?</p>