Questions tagged [rolling-average]
104 questions
0
votes
1 answer
monthly rolling average in python with 1 month lag
I have calculated monthly rolling average for my data but there is a one-month lag (delay) in calculation such that if we are in October, the results need to deliver the September monthly average and so on for the rest of the year for each month.…

Nada
- 9
- 3
0
votes
1 answer
Rolling average that skips a predetermined number of rows
Good day/evening all,
Hope you are well. I would be grateful if someone could give me some hints about how to solve this problem.
I have variable x with dates attached. I would like to create a rolling average of x, but I would like the average to…

jamchops
- 25
- 3
0
votes
1 answer
Use Rolling Mean as historic data for multiple future data points in Rstudio
I'm building a multifactorial sales forecasting model in R studio using xgBoost regression. I have built up lags with this function
Create_lags <- function(MyData, start_index_lag, num_lags) {
lags =seq(from =start_index_lag,…

VR88
- 21
- 1
- 7
0
votes
1 answer
How to calculate the rolling mean of the nth previous values
So let's say I have a data frame of a series of values which are assigned to one of two groups ('Gp'):
set.seed(12)
df <- data.frame(id = sample(1:50,50), Gp = sample(2, 50, TRUE))
Here are the top 20 values from this:
df
row id Gp
1 4 1
2 41…

SqueakyBeak
- 366
- 4
- 15
0
votes
0 answers
Excel - Rolling Average on multiple Sheets #Value Error
I am trying to get average on
Sheet#1 as Data entered from sheet 2- sheet13 For example :
Output result should be rolling average of Cell - G2 from Sheet 2 - Sheet13
Every month Data added and result should change as rolling average.
following…

Prakriti
- 9
- 3
0
votes
1 answer
Calculate 3 month rolling avg grouped by person when there are multiple transactions per day per person
I need to query a table that has "Units" "Date" and "Name" and get the rolling average of units per month per person when there are multiple units per day per person on individual rows.
For example:
Name Date Units
John Smith …
0
votes
1 answer
Loop to sum weekly rolling average
I am new to coding. I have a data set of daily stream flow averages over 20 years. Following is an example:
DATE FLOW
1 10/1/2001 88.2
2 10/2/2001 77.6
3 10/3/2001 68.4
4 10/4/2001 61.5
5 10/5/2001 55.3
6 …

Madeline
- 1
0
votes
1 answer
Rolling averages in SQL for assets which are added progressively to the population
My data-table has various assets along with the groups they belong to and the date of entry into that group/population/data-table.
Now I can calculate the average age of the assets but how would I actually go about calculating an average age over a…

Kamran
- 1
- 1
0
votes
0 answers
Is there a way to calculate yearly moving average in Python?
I have some football data that I am modifying for analysis. I basically want to calculate career and yearly per game averages on a weekly basis for several stats.
Example
What I have:
Player
Year
Week
Rushing Yards
Catches
Seth…

kh7
- 1
0
votes
1 answer
Python how to create a rolling mean with additional conditions
I have a pandas dataframe as seen below:
Date (DMY) Total 3-day-min
01/03/2013 0.102 -
02/03/2013 0.122 -
03/03/2013 0.047 0.047
04/03/2013 0.050 0.047
05/03/2013 0.052 0.049 …

dinn_
- 93
- 1
- 10
0
votes
1 answer
Moving averages without using masked values
I would like to know if you could give me a way to calculate rolling means on a numpy masked array, without using the masked values.
I currently am using the convolve numpy method, but it does not work:
import numpy as…

Greg Madman
- 49
- 5
0
votes
1 answer
0
votes
1 answer
Google sheets- how to calculate the average value of the last n days, given that n number is variable?
I need some help to calculate the moving average of the previous n days to date, given that n number is variable due to any given day can contain multiple values insertion (usually from 2 to five). So one specific day can contain several…

Kenneth
- 1
0
votes
2 answers
How do I calculate the moving average of the 7 most recent values after the first Seven values in java?
My question is how do I calculate the moving average of the 7 most recent values using ArrayList after the first seven values?
This is my code for the first seven values, what I fail to understand is how I would get the average of the 7 most recent…

Tanish
- 5
- 2
0
votes
2 answers
How to create an SQL window function column per category in MySQL?
I am using MySQL to create a window function per category in another column. I am thinking of maybe combining a pivot table with a window function, however, do not know how to do a pivot table with MySQL.
Below is what I have in mind to do, create a…