

def _update_buffer(self, frame):
    old_buffer = self.get_current()
    if (self._pos >= self._window):
        old_buffer = old_buffer.iloc[:, 1:, :]
    nans = pd.isnull(old_buffer)
    non_nan_cols = set(old_buffer.minor_axis[(~ np.all(nans, axis=(0, 1)))])
    new_cols = set(frame.columns).difference(non_nan_cols)
    self.minor_axis = _ensure_index(new_cols.union(non_nan_cols))
    non_nan_items = set(old_buffer.items[(~ np.all(nans, axis=(1, 2)))])
    new_items = set(frame.index).difference(non_nan_items)
    self.items = _ensure_index(new_items.union(non_nan_items))
    new_buffer = self._create_buffer()
    new_buffer.update(self.buffer.loc[non_nan_items, :, non_nan_cols])
    self.buffer = new_buffer

dataset/ETHPy150Open quantopian/zipline/zipline/utils/data.py MutableIndexRollingPanel._update_buffer/original