How do I subtract the previous row from the current row in a pandas dataframe and apply it to every row; without using a loop?

后端 未结 2 596
失恋的感觉
失恋的感觉 2021-02-03 23:56

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

2条回答
  •  后悔当初
    2021-02-04 00:25

    MaxU solutions suits in your case. If you want to perform more complex computations based on your previous rows you should use shift

提交回复
热议问题