title: How to count only new data in pandas, and not the whole table?
body: <p>There is a table:</p>
  
  <pre><code>import pandas as pd
  data = {
      'one': list(range(2, 15, 4)),
      'two': list(range(4, 16, 3))
  }
  df = pd.DataFrame(data)
  df
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>-   one two
  0   2   4
  1   6   7
  2   10  10
  3   14  13
  </code></pre>
  
  <p>There is a data processing method:</p>
  
  <pre><code>def compute(df):
    df['rol1'] = df.rolling(3, min_periods=1).one.mean()
    df['rol2'] = df.rolling(3, min_periods=1).two.quantile(0.5)
    df['rol3'] = df.rolling(2, min_periods=1).rol2.min()
    return df
  
  df = compute(df)
  df
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>-   one two rol1    rol2    rol3
  0   2   4   2.0     4.0     4.0
  1   6   7   4.0     5.5     4.0
  2   10  10  6.0     7.0     5.5
  3   14  13  10.0    10.0    7.0
  </code></pre>
  
  <p>Great, and now a new line is added:</p>
  
  <pre><code>newData = {'one': 13, 'two': 6}
  df = df.append(newData, ignore_index=True)
  df
  </code></pre>
  
  <p>As a result, a line is added, in the remaining fields, NaN is set:</p>
  
  <pre><code>-   one     two     rol1    rol2    rol3
  0   2.0     4.0     2.0     4.0     4.0
  1   6.0     7.0     4.0     5.5     4.0
  2   10.0    10.0    6.0     7.0     5.5
  3   14.0    13.0    10.0    10.0    7.0
  4   13.0    6.0     NaN     NaN     NaN
  </code></pre>
  
  <p><strong>How now to tell pandas that he would count only the data for the last line?</strong> Because if I call <code>df = compute(df)</code> again, it will compute the whole table. And with big data, this is quite a lot of time, but I would like to work with data in real time.
  There is an option to create a copy function and use <code>tail</code> instead of <code>rolling</code>, but I don’t want to make pastes of the same logic. The final algorithm in my program is complicated and I don’t want to duplicate it either.
  Thanks in advance for the answer!)</p>