Pandas: Exponentially decaying sum with variable weights
问题 Similar to this question Exponential Decay on Python Pandas DataFrame, I would like to quickly compute exponentially decaying sums for some columns in a data frame. However, the rows in the data frame are not evenly spaced in time. Hence while exponential_sum[i] = column_to_sum[i] + np.exp(-const*(time[i]-time[i-1])) * exponential_sum[i-1] , the weight np.exp(...) does not factor out and it's not obvious to me how to change to that question and still take advantage of pandas/numpy