title: Using Pandas to shift only a slice of a DatetimeIndex series and put it back in to the file shifted ahead
body: <p>I have a time series that had a DST issue. Simply put, I am wanting to pull out a slice of the series and shift it ahead an hour (minutely data), and then put the shifted slice back in and ffill any missing values with 0. </p>
  
  <p>Here is the data I need to shift an hour:</p>
  
  <pre><code>2014,345,0744,0,0
  2014,345,0745,0,0
  2014,345,0746,0,0
  2014,345,0747,0,.018
  2014,345,0748,.052,.215
  2014,345,0749,.155,.268
  2014,345,0750,.172,.375
  2014,345,0751,.396,.429
  2014,345,0752,.413,.447
  </code></pre>
  
  <p>Here is an example of where I need the above to be (shifted ahead an hour):</p>
  
  <pre><code>2014,344,0844,0,0
  2014,344,0845,0,0
  2014,344,0846,0,0
  2014,344,0847,0,.054
  2014,344,0848,0,.107
  2014,344,0849,.138,.197
  2014,344,0850,.189,.125
  2014,344,0851,.276,.179
  2014,344,0852,.155,.143
  2014,344,0853,.103,.161
  </code></pre>
  
  <p>My approach has been to slice out the time chunk that I need to shift data by an hour, shift the data by an hour, and then <strong>replace the original data with the shifted slice.</strong></p>
  
  <p>So far I have tried this:</p>
  
  <pre><code>slice = df['20141211 02:00':'20141227 22:00'] #The slice needing to be shifted
  
  shifted = slice.shift(periods=1, freq='60T') #Move the datetime values forward an hour
  
  df.merge(shifted, left_index=True, right_index=True)
  </code></pre>
  
  <p>The slice and shifting worked fine, but the last line of code is not doing what I would like it to. I have also tried it with all variants of left_index and left_on...the closest I get is what the above gives me:</p>
  
  <pre><code>    3_x 4_x 3_y 4_y
  datetime                
  2014-12-11 07:30:00 0.000   0.000   0.000   0.000
  2014-12-11 07:31:00 0.000   0.000   0.000   0.000
  2014-12-11 07:32:00 0.000   0.000   0.000   0.000
  2014-12-11 07:33:00 0.000   0.000   0.000   0.000
  2014-12-11 07:34:00 0.000   0.000   0.000   0.000
  2014-12-11 07:35:00 0.000   0.000   0.000   0.000
  2014-12-11 07:36:00 0.000   0.000   0.000   0.000
  2014-12-11 07:37:00 0.000   0.000   0.000   0.000
  2014-12-11 07:38:00 0.000   0.000   0.000   0.000
  2014-12-11 07:39:00 0.000   0.000   0.000   0.000
  2014-12-11 07:40:00 0.000   0.000   0.000   0.000
  2014-12-11 07:41:00 0.000   0.000   0.000   0.000
  2014-12-11 07:42:00 0.000   0.000   0.000   0.000
  2014-12-11 07:43:00 0.000   0.000   0.000   0.000
  2014-12-11 07:44:00 0.000   0.000   0.000   0.000
  2014-12-11 07:45:00 0.000   0.000   0.000   0.000
  2014-12-11 07:46:00 0.000   0.000   0.000   0.000
  2014-12-11 07:47:00 0.000   0.018   0.000   0.000
  2014-12-11 07:48:00 0.052   0.215   0.000   0.000
  2014-12-11 07:49:00 0.155   0.268   0.000   0.000
  2014-12-11 07:50:00 0.172   0.375   0.000   0.000
  2014-12-11 07:51:00 0.396   0.429   0.000   0.000
  2014-12-11 07:52:00 0.413   0.447   0.000   0.000
  </code></pre>
  
  <p>Notice how the sift has worked, and it has added another couple columns, but I wanted to replace the original columns (df, on the left) with shifted (those 2 on the right). To start values around 8:47 not 7:47, i.e.:</p>
  
  <pre><code>2014-12-11 08:44:00 6.338   7.080   0.000   0.000
  2014-12-11 08:45:00 7.170   8.030   0.000   0.000
  2014-12-11 08:46:00 7.720   8.150   0.000   0.000
  2014-12-11 08:47:00 6.959   7.780   0.000   0.018
  2014-12-11 08:48:00 6.166   6.991   0.052   0.215
  2014-12-11 08:49:00 5.029   6.061   0.155   0.268
  2014-12-11 08:50:00 4.444   5.632   0.172   0.375
  </code></pre>