Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [rolling-sum]

The tag has no usage guidance.

rolling-sum
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, ...
Andrei Filep's user avatar
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 ...
ayyyran's user avatar
  • 23
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),...
sharp's user avatar
  • 75
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 ...
VanodyaPerera's user avatar
-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 ...
Teddy's user avatar
  • 143
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-...
Bea's user avatar
  • 27
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 ...
Alisha Dcosta's user avatar
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 ...
LuZ's user avatar
  • 15
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',...
Evan's user avatar
  • 373
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 ...
Nora Seinfield's user avatar
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 ...
Matias Ochoa's user avatar
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 ...
imhaka's user avatar
  • 37
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 ...
anonymous13's user avatar
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 ...
kiwi_kimchi's user avatar
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 ...
caldwellst's user avatar
  • 5,851

15 30 50 per page
1
2 3 4 5 6