I am using Python3.5 and I am working with pandas. I have loaded stock data from yahoo finance and have saved the files to csv. My DataFrames load this data from the csv. This
MaxU solutions suits in your case. If you want to perform more complex computations based on your previous rows you should use shift