title: How can a DataFrame be shifted to the nearest time index to the one specified?
body: <p>I have a DataFrame of values recorded and the index set to DatetimeIndex. A value is recorded approximately every 15 minutes.</p>
  
  <p>I want to add a new column that is the fractional difference of the current value from a value 24 hours previously. Since the values are recorded <em>approximately</em> every fifteen minutes, I want to shift to the time index that is closest to 24 hours previously. If I try to do this exactly, I end up with a whole lot of <code>NaN</code>s:</p>
  
  <pre><code>df["value"] / df["value"].shift(freq = datetime.timedelta(days = -1))
  </code></pre>
  
  <p>How should this shift be done so that the shift is to the nearest possible time index to the one specified? Is there an alternative, easier way to think about this?</p>
  
  <p>Here is an example that illustrates the issue:</p>
  
  <pre><code>df = pd.DataFrame(
      [
          [pd.Timestamp("2015-07-18 13:53:33.280"), 10],
          [pd.Timestamp("2015-07-19 13:54:03.330"), 20],
          [pd.Timestamp("2015-07-20 13:52:13.350"), 30],
          [pd.Timestamp("2015-07-21 13:56:03.126"), 40],
          [pd.Timestamp("2015-07-22 13:53:51.747"), 50],
          [pd.Timestamp("2015-07-23 13:53:29.346"), 60]
      ],
      columns = [
          "datetime",
          "value"
      ]
  )
  
  df.index = df["datetime"]
  del df["datetime"]
  df.index = pd.to_datetime(df.index.values)
  
  df["change"] = df["value"] / df["value"].shift(freq = datetime.timedelta(days = -1))
  </code></pre>