I have a pandas df and with df['Battery capacity'] = np.clip(df['total_load'].cumsum() + 5200,-np.inf,5200)
I compute the values from "total_load" with the values from "Battery_capacity".
The problem which I cannot solve is, that for example at 14:00:00 "Battery capacity" is at 5200 but at 15:00:00 it doesn't substract the -221 from 5200 because it subtract from the value which is adding up in the background. I set the bounds to 5200 with np.clip()
So what I would like to have is something like:
time total_load battery capacity
2016-06-01 14:00:00 1980 5200
2016-06-01 15:00:00 -221 4979 (start subtracting from 5200)
2016-06-01 16:00:00 -14.5 4964.5
How would I implement that into my code?
Thanks!