Questions tagged [rolling-average]

104 questions
0
votes
2 answers

pandas rolling average with a rolling mask / excluding entries

I have a pandas dataframe with a time index like this import pandas as pd import numpy as np idx = pd.date_range(start='2000',end='2001') df = pd.DataFrame(np.random.normal(size=(len(idx),2)),index=idx) which looks like this: 0 …
stan
  • 45
  • 4
0
votes
1 answer

pandas apply with different arg for each column/row

Assume I have a M (rows) by N (columns) dataFrame df = pandas.DataFrame([...]) and a vector of length N windows = [1,2,..., N] I would like to apply a moving average function to each column in df, but would like the moving average to have…
Michael
  • 7,087
  • 21
  • 52
  • 81
0
votes
1 answer

How to set the 5 minutes rolling mean window to re-sample data with Pandas Python

How can I set the 5 minutes window size to re-sample the data through the rolling mean? I tried different ways but I always get error about the DateTimeIndex, even my data has Index as DateTimeIndex.. Any one knows the right way to do it?? Data …
id101112
  • 1,012
  • 2
  • 16
  • 28
0
votes
1 answer

Rolling cumulative product between dates

I have data (dataframe called returns) that looks like this DATE TICKER RETURN_DATA 2010-01-01 xxx 0.05 2010-01-01 yyy 0.01 2010-01-02 xxx 0.02 2010-01-02 yyy 0.08 ..... 2010-01-29 xxx …
ThatQuantDude
  • 759
  • 1
  • 9
  • 26
-1
votes
1 answer

3 days moving average in excel

I am trying to calculate the 3-day moving average in excel. And I want excel to not calculate the moving average if any one day (out of 3 days of daily precipitation data) contains a zero value. Can anyone help and guide thank's
-1
votes
1 answer

Get last 3 month average on daily data in SQL

I have a sales dataset where I need to calculate last 3 month sales average for each product entry. This is what it is supposed to look like. So for a September entry for a given store, sales rep, product combination , L3M should be Sales of (June +…
jen
  • 11
  • 2
-1
votes
1 answer

How to create rolling/moving average in ACCESS QUERY for the last 7 days,30 days Accumulative Avg?

My query name: Total Daily Orders Summary My Input [2 columns]: business_date,# Daily Orders I need these 3 columns as calculated output: Orders# (7 days) Average, Orders# (30 Days) Average ,Orders# (Acuum Average) [i.e.from day one to date] I have…
-1
votes
1 answer

How to get Hourly average of Occurrences of event using TimeStamp/Date List in Scala

Sample Data for Timestamp 2018-04-07 07:07:17 2018-04-07 07:32:27 2018-04-07 08:36:44 2018-04-07 08:38:00 2018-04-07 08:39:29 2018-04-08 01:43:08 2018-04-08 01:43:55 2018-04-09 07:52:31 2018-04-09 07:52:42 2019-01-24 11:52:31 2019-01-24…
-1
votes
1 answer

Calculate and store average for following table in SQL Server

I am trying to calculate average of P value in following table as per month in per_date column grouped by qu_def column. and store it as follows in a SQL Server table:
V_immo
  • 31
  • 1
  • 7
-1
votes
1 answer

3 month rolling Avg

Question: need help with query to show as a 3-month rolling average This is what I currently have SELECT Date, month(date) AS[Month], year(date) AS[Year], AVG(ALL Amount) OVER (PARTITION BY Date ORDER BY Date ASC) AS Average FROM …
-1
votes
1 answer

How to calculate time varying historical mean with Stata

How can I calculate the mean of X using an expanding window with at least four observations? Here is a numeric example: clear input…
Macrina
  • 25
  • 8
-1
votes
1 answer

SQL Server rolling average

select Date, [Close], avg([close]) over (order by date asc rows 4 preceding) as MA10 from dbo.APPL This query returns the rolling 4 day average of stock prices. However I want to show the values as NULL if preceding days are fewer than…
Tony
  • 121
  • 1
  • 2
  • 7
-2
votes
1 answer

Calculate rolling average for all columns pandas

I have the below dataframe: df = pd.DataFrame({'a': [2.85,3.11,3.3,3.275,np.NaN,4.21], 'b': [3.65,3.825,3.475,np.NaN,4.10,2.73], 'c': [4.3,3.08,np.NaN,2.40, 3.33, 2.48]}, index=pd.date_range('2019-01-01', periods=6, …
Rajat
  • 111
  • 13
-3
votes
2 answers

Rolling Average for last 3 years for same week number Python Pandas

I am finding average of the same weeks whenever there is data available for example 201932, using the average of the data from 201632, 201732 and 201832. Example : 2019 is year and 32 is week number
vij
  • 21
  • 1
  • 1
  • 4
1 2 3 4 5 6
7