title: pandas interpolate with nearest for non-numeric values
body: <p>I have a dataframe with numeric and non-numeric values with a datetime index:</p>
  
  <pre><code>df = pd.DataFrame([
      {'date': datetime(2017, 4, 24, 1), 'a':1, 'b':2, 'c': "hee"},
      {'date': datetime(2017, 4, 24, 2), 'a':2, 'b':4, 'c': 'hoo'},
      {'date': datetime(2017, 4, 24, 3), 'a':4, 'b':8, 'c': 'joo'},
      {'date': datetime(2017, 4, 24, 4), 'a':8, 'b':16, 'c': 'jee'}
  ]).set_index('date')
  </code></pre>
  
  <p>I would like to:</p>
  
  <ul>
  <li>linear interpolate the numeric values; and</li>
  <li>get the nearest value for non-numeric values.</li>
  </ul>
  
  <p>What is the most elegant implementation?</p>
  
  <p><strong>Strategy 1</strong></p>
  
  <p>Interpolate all, then <code>fillna</code>:</p>
  
  <pre><code>df = df.resample('20T').interpolate('linear')
  df.fillna(method='nearest')
  </code></pre>
  
  <p>But... the <a href="https://github.com/pandas-dev/pandas/issues/9471" rel="noreferrer"><code>nearest</code></a> method is not implemented.</p>
  
  <p><strong>Strategy 2</strong></p>
  
  <p>Split the numeric and non-numeric columns</p>
  
  <pre><code>df2 = df.resample('20T')
  df_a = df2._get_numeric_data().interpolate('linear')
  df_b = df2[list(set(df.columns) - set(set(df_a.columns)))].interpolate('nearest')
  </code></pre>
  
  <p>which gives an error:</p>
  
  <blockquote>
    <p>TypeError: Cannot interpolate with all NaNs.</p>
  </blockquote>
  
  <p><strong>update</strong></p>
  
  <p>Interpolation with the nearest method, does apply to Boolean and numeric values, but not for strings, e.g.:</p>
  
  <pre><code>df.resample('20T').intepolate('nearest')
  </code></pre>