title: Complicated transformation pandas
body: <p>Assume that I have the following data set </p>
  
  <pre><code>table = [[datetime.datetime(2015, 1, 1), 1, 0.5],
           [datetime.datetime(2015, 1, 27), 1, 0.5],
           [datetime.datetime(2015, 1, 31), 1, 0.5],
           [datetime.datetime(2015, 2, 1), 1, 2],
           [datetime.datetime(2015, 2, 3), 1, 2],
           [datetime.datetime(2015, 2, 15), 1, 2], 
           [datetime.datetime(2015, 2, 28), 1, 2],
           [datetime.datetime(2015, 3, 1), 1, 3],
           [datetime.datetime(2015, 3, 17), 1, 3],
           [datetime.datetime(2015, 3, 31), 1, 3]]
  
  df = pd.DataFrame(table, columns=['Date', 'Id', 'Value'])
  </code></pre>
  
  <p>Now, I'd like to find the last value of each month, move it monthwise to the values of the next month, and finally take the cumulative product of these values. Doing this procedure for the above data should result in (performing each step):</p>
  
  <ol>
  <li><p>Finding the last entry of each month and moving them monthwise would result in</p>
  
  <pre><code>            Date       Id   Value  Temp
           0 2015-01-01   1    0.5    NaN
           1 2015-01-27   1    0.5    NaN
           2 2015-01-31   1    0.5    NaN
           3 2015-02-01   1    2.0    0.5
           4 2015-02-03   1    2.0    0.5
           5 2015-02-15   1    2.0    0.5
           6 2015-02-28   1    2.0    0.5
           7 2015-03-01   1    3.0    2.0
           8 2015-03-17   1    3.0    2.0
           9 2015-03-31   1    3.0    2.0
  </code></pre></li>
  <li><p>Filling the <code>NaN</code>'s with <code>1</code>, taking the cumulative product, and dropping <code>temp</code> would result in</p>
  
  <pre><code>             Date      Id   Value  Result
           0 2015-01-01   1    0.5     1
           1 2015-01-27   1    0.5     1
           2 2015-01-31   1    0.5     1
           3 2015-02-01   1    2.0    0.5
           4 2015-02-03   1    2.0    0.5
           5 2015-02-15   1    2.0    0.5
           6 2015-02-28   1    2.0    0.5
           7 2015-03-01   1    3.0    1.0
           8 2015-03-17   1    3.0    1.0
           9 2015-03-31   1    3.0    1.0
  </code></pre></li>
  </ol>
  
  <p>I hope that this is clear enough. And if anyone wonders why on earth I'd like to do this is because I've got MTD-data, and it needs to be resampled. Thanks, Tingis.</p>
  
  <p><strong>edit</strong>
  The number of entries per month are "random", as in they can either be as long as the month or shorter (business data...)</p>