EDIT:
I'm trying to simulate online decision making process. In each iteration, I want to read a new line from a known data frame and make a decision according to it. Additionally, I want to save the last n rows of the dataframe that I used. Unfortunately, even iterating through the rows is very slow.
How can I do this better?
import pandas as pd
import numpy as np
import time
t0 = time.time()
s1 = np.random.randn(2000000)
s2 = np.random.randn(2000000)
time_series = pd.DataFrame({'s1': s1, 's2': s2})
n = time_series.shape[0]
for t in range(1, n - 1):
curr_data = time_series.iloc[t]
print time.time() - t0
OLD VERSION:
I have a loop in which in every iteration I need to delete the first row of a dataframe, and append another row to the end. What would be the fastest method to use?