title: Resampling a Pandas dataframe while forward filling (ffill) the values
body: <p>I have a dataframe where a snippet looks like this</p>
  
  <pre><code>    Time                    Temperature
  19  2019-01-01 11:48:51     23.798
  20  2019-01-01 11:48:53     23.832
  21  2019-01-01 11:48:54     NaN
  22  2019-01-01 11:48:55     23.817
  23  2019-01-01 11:48:56     NaN
  </code></pre>
  
  <p>I want to resample this to '2S' while making sure that the last measured value will replace any NaNs.</p>
  
  <pre><code>df.resample('2S', on='Time').mean().ffill()
  </code></pre>
  
  <p>A snippet of the result looks like this</p>
  
  <pre><code>                        Temperature
  Time            
  2019-01-01 11:48:52     23.832
  2019-01-01 11:48:54     23.817
  2019-01-01 11:48:56     23.809
  </code></pre>
  
  <p>Notice the value at timestamp t=54s. What I want is the temperature 23.832 from t=53s, since that is the last recorded value at this timestamp. Instead it fillings with the value from t=55s</p>
  
  <p><strong>Edit 1:</strong>
  After a reply, I tried the following:</p>
  
  <pre><code>df.ffill().resample('2S', on='Time').first()
  </code></pre>
  
  <p>But this gives the following result, where the new t=52s is equal to the old t=t=53s, which is not the behavior I am after...</p>
  
  <pre><code>                        Temperature
  Time            
  2019-01-01 11:48:50     23.798
  2019-01-01 11:48:52     23.832
  2019-01-01 11:48:54     23.832
  2019-01-01 11:48:56     23.817
  </code></pre>
  
  <p><strong>EDIT 2:</strong>
  To make it easier to understand, this is the output I desire. I don't care if it is sampled on odd or even seconds.</p>
  
  <pre><code>                        Temperature
  Time            
  2019-01-01 11:48:52     23.798
  2019-01-01 11:48:54     23.832
  2019-01-01 11:48:56     23.817
  </code></pre>