I have a process in excel that I want to replicate in Python, but I haven’t been able to figure out a good way of doing it. I want this process to be written as a function if possible as I am going to be running a lot of data through it. As you can see from my photos, the function doesn’t reference the Input accumulated row at all, but feel free to use it if you feel it would be helpful. The input data doesn’t have any rhyme or reason to it, they are just dummy values for this example.
Here you can see the excel process I’m referencing.
Example at time 35: (https://i.sstatic.net/nSqUnVTP.png)
Example at time 22: (https://i.sstatic.net/rUdVvl0k.png)
Example at time 12: (https://i.sstatic.net/4anQ6GDL.png)
Trying my best to put this function into words: at each point in time, you’re taking the sum of the 12 most recent inputs (or less if time < 12), multiplying that by the first factor, adding to that the sum of the prior 12 inputs multiplied by the next factor, and so on, repeating until we’ve reached the beginning of the input list.
Ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.