Pandas - Calculating daily differences relative to earliest value
<p>This is probably pretty easy, but for some reason I am finding it quite difficult to complete. Any tips would be greatly appreciated. I have some time series data consisting of 5-minute intervals each day, ala:</p>

<pre><code>Date                   Values
2012-12-05 09:30:00    5
2012-12-05 09:35:00    7
2012-12-05 09:40:00    3
2012-12-05 09:45:00    2
2012-12-05 09:50:00    15
2012-12-06 09:30:00    4
2012-12-06 09:35:00    3
2012-12-06 09:40:00    8
2012-12-06 09:45:00    1
</code></pre>

<p>I would like to calculate the differences relative to the first value of the day (which in this case always will be the 9:30 value), ie. end up with this DataFrame:</p>

<pre><code>Date                   Values
2012-12-05 09:30:00    0
2012-12-05 09:35:00    2
2012-12-05 09:40:00    -2
2012-12-05 09:45:00    -3
2012-12-05 09:50:00    10
2012-12-06 09:30:00    0
2012-12-06 09:35:00    -1
2012-12-06 09:40:00    4
2012-12-06 09:45:00    -3
</code></pre>

<p>You can use broadcasting:</p>

<pre><code>df.Values - df.Values.iloc[0]
</code></pre>

python pandas resampling