Questions tagged [rolling-sum]
The rolling-sum tag has no usage guidance.
rolling-sum
77
questions
0
votes
1
answer
38
views
Rolling Sum of dataframe columns
I have a dataframe with following values:
df = pd.DataFrame({
'S1':[38.868, 39.231, 39.427, 38.992, 39.071, 39.003],
'S2':[63.631, 63.239, 63.463, 63.675, 63.571, ...
0
votes
1
answer
59
views
How to loop through and create a rollover sum in python?
Looking at the table, I am looking to replicate the Rollover column in a Python dataframe. The Rollover looks at:
Rollover is created when production > max capacity. The following date will look ...
1
vote
2
answers
71
views
Cumulative sum of one column based on rolling window in another column
I am trying to find the cumulative sum of x=c(1,2,3,4,5) based on moving window of y=c(1,1,2,3,2). I tried the following code based on rollapply in zoo package:
rollapply(c(1,2,3,4,5),c(1,1,2,3,2),...
0
votes
3
answers
271
views
Dynamic rolling sum in excel
How can I calculate the rolling sum of a column based on another column?
Example:
Input data are the first 3 columns in the below table. The result column that I am trying to get is highlighted in ...
-1
votes
2
answers
91
views
Do a rolling sum of a columns using python
I need to do a rolling sum of a columns of a dataframe, verify if the sum of the rolling (2 to 5 lines) is = 0 and take all the lines from the rolling to flag them as "canceled".
I tried ...
1
vote
2
answers
452
views
Running, Rolling Sum in a specified window in R
I want to determine the running total of a column within a specified date window.
id
date
value
7
2023-01-01
1
7
2023-01-03
1
7
2023-01-04
3
7
2023-01-05
2
7
2023-01-06
1
7
2023-01-07
5
7
2023-...
0
votes
1
answer
358
views
How can I get the cumulative sum in R for X number of rows and it restarts from a specific row lets say I want to restart it from the 2nd row [duplicate]
I have a df like this
a b
1 3
2 3
3 3
4 3
1 3
2 3
3 3
4 3
I want the solution like this. I want the moving sum of column 'a' for the 3 intersections which is the value from column ...
0
votes
1
answer
86
views
Excel (or) Power BI, Rolling Sum
Is there any way in Excel Pivot or Power BI to do the rolling sum of the given data (let say monthly)?
Let say I have a list of cases, each row represent case count and amount. The project start date ...
0
votes
2
answers
144
views
How can I compute a rolling sum using groupby in pandas?
I'm working on a fun side project and would like to compute a moving sum for number of wins for NBA teams over 2 year periods. Consider the sample pandas dataframe below,
pd.DataFrame({'Team':['Hawks',...
0
votes
2
answers
333
views
Group by rolling 30 minute timeinterval using python
I am quite stuck.
I have a set of data looking like this:
I have a date and 0 is the number of baggage for that specific time interval.
I would like to create a 30 minute forward looking rolling time ...
1
vote
2
answers
54
views
Rolling Sum by 3 Conditions in R based on another data frame
I've got a df and i need to perform a rolling sum in another dataframe based on the values of the first df
All the transactions of each company, by date & account
This is the dataframe I want to ...
0
votes
1
answer
123
views
How to do rolling sum with conditional window criteria on different index levels in Python
I want to do a rolling sum based on different levels of the index but am struggling to make it a reality. Instead of explaining the problem am giving below the demo input and desired output along with ...
1
vote
2
answers
850
views
Cumulative sum when value in other column is non-zero
I have a huge dataframe with multiple columns as below . I am trying to find cummulative sum of time when value in b is -1 which is preceeded by 1. I have tried cummulative sum but it's not working.
I ...
1
vote
2
answers
169
views
Getting the rolling.sum of row values with irregular time intervals
I am trying to get the rolling.sum of my time series. However, the rows have varying time intervals (see below my df_water_level_US1 dataframe):
DATE TIMEREAD WATERLEVEL(M) DateAndTime
0 ...
2
votes
2
answers
57
views
Find longest rolling sum under/equal a threshold for each group
I am trying to find the most efficient way to identify the longest rolling sum of a vector where the value is below a specific threshold. For instance, if we had 1:10 and a threshold of 6, then 3 is ...