红颜莎娜
尝试除以移位from pandas import pandas as pdfinal_df = pd.DataFrame({"Col1": [10, 20, 15, 30, 45], "Col2": [13, 23, 18, 33, 48], "nav": [3, 6, 9, 27, 108]}, index=pd.date_range("2020-01-01", "2020-01-05"))final_df["change"] = final_df["nav"].div(final_df["nav"].shift(1))print(final_df) Col1 Col2 nav change2020-01-01 10 13 3 NaN2020-01-02 20 23 6 2.02020-01-03 15 18 9 1.52020-01-04 30 33 27 3.02020-01-05 45 48 108 4.0