title: How to get the 'cardinal' day of the year in Pandas?
body: <p>My df looks like this, where 'O', is the ordinal date of the year.</p>
  
  <pre><code>            Close   O
  Date        
  1950-01-03  16.66   3
  1950-01-04  16.85   4
  1950-01-05  16.93   5
  1950-01-06  16.98   6
  1950-01-09  17.08   9
  1950-01-10  17.03   10
  1950-01-11  17.09   11
  1950-01-12  16.76   12
  1950-01-13  16.67   13
  1950-01-16  16.71   16
  </code></pre>
  
  <p>I would like to have the cardinal day of the year given the data set. The desired outcome is:</p>
  
  <pre><code>            Close   O  C  
  Date        
  1950-01-03  16.66   3  1   
  1950-01-04  16.85   4  2
  1950-01-05  16.93   5  3
  1950-01-06  16.98   6  4
  1950-01-09  17.08   9  5
  1950-01-10  17.03   10 6
  1950-01-11  17.09   11 7
  1950-01-12  16.76   12 8
  1950-01-13  16.67   13 9
  1950-01-16  16.71   16 10
  </code></pre>
  
  <p>Note: Data set is many years long, so the key is that the count restarts every time there's a new year in the index.</p>
  
  <p>Thanks</p>