Questions tagged [rolling-average]

104 questions
0
votes
0 answers

rolling 3-month average on past financials

Use the data warehouse that is part of the "AdventureWorks 2016 and Scripts for SQL Server 2016 CTP3" you previously installed from the Course and Topic Materials to complete the assignment. The finance department wants to be able to project future…
brs
  • 1
0
votes
1 answer

How to use pandas.rolling().mean for 3D input array?

For 1D I can use: a=np.array([1,2,3,4]) b=pandas.Series(a).rolling(window=3,center=True).mean() But the problem is, if I have array a, in 3D then using this method gives error Exception: Data must be 1-dimensional The code which I used…
Prvt_Yadav
  • 324
  • 1
  • 6
  • 20
0
votes
2 answers

Rolling Mean with Time Offset Pandas

I have a data set of timestamps & values in pandas. The interval between timestamps is ~12 seconds over a total timespan of roughly one year but sometimes there are missing points (i.e., the time series is irregular so I can't use fixed window…
cooper
  • 315
  • 1
  • 16
0
votes
1 answer

Pandas calculate and apply weighted rolling average on another column

I am having a hard time figuring out how to get "rolling weights" based off of one of my columns, then factor these weights onto another column. I've tried groupby.rolling.apply (function) on my data but the main problem is just conceptualizing how…
0
votes
1 answer

Average of 5 specific cells inclusive of active row the 2 above/2 below skipping blanks rather than including in the range

My Excel skills are relatively limited so am unsure if this can be done with a formula but I am hopeful it can as my Macro skills go as far a recording a Macro and making basic edits. Basically I have an annual table, inclusive of December from the…
S.B
  • 1
  • 2
0
votes
1 answer

Calculate Rolling Geomean window in Pandas like it is calculated in EXCEL

In EXCEL, calculating a geomean of size 2 on Col1, would result in a 6 in row 1 of Geo_2 as the geomean of 4 and 9 is 6. In Pandas or numpy it appears to be the reverse, with a min_period = 1, the first row reflects the calculation of just 1 value…
0
votes
1 answer

AttributeError: module 'pandas' has no attribute 'rolling_mean'

temp = [] fields = ['volt', 'rotate', 'pressure', 'vibration'] for col in fields: temp.append(pd.rolling_mean(pd.pivot_table(telemetry, index='datetime', …
özlem bulu
  • 31
  • 2
  • 5
0
votes
1 answer

Python - pandas: Rollingmean command is not working

dataframe = pd.DataFrame(data={'user': [1,1,1,1,1,2,2,2,2,2], 'usage': [12,18,76,32,43,45,19,42,9,10]}) dataframe['mean'] = dataframe.groupby('user'['usage'].apply(pd.rolling_mean, 2)) Why this code is not working? i am getting an error of rolling…
0
votes
1 answer

Rolling mean based on conditions R

Here is a brief description of my data: The first column is date by month, the second column is binary variable (0 or 1), the third column is stock return, so each month's stock return point to 1 or 0. I want to calculate the 12-month rolling mean…
0
votes
1 answer

Python Optimization Moving Average

I want to create moving average strategy with rolling funtion and scipy optimization but my code do not optimize rolling. It gives result which I entered as first x0 values. I searched for it in google there are ways to create all rolling…
0
votes
0 answers

Pandas GroupBy Datetime and Mean using Rolling

I want to calculate the mean of values rolling over Datetime index with a window of an P period of time centering on a Q period of time. I have a dataset that have records in second: Time Temperature 2017-11-28 22:00:03 …
ambigus9
  • 1,417
  • 3
  • 19
  • 37
0
votes
2 answers

Excel: Calculate a Rolling Average Based on Dynamic Range

I am trying to calculate rolling average based on a dynamic range. To give you an example, my data-set looks like the one below. I am trying to calculate the rolling average of the parameter "No. of Users" based on the range "Box no." (12, 13,…
0
votes
2 answers

Average with partial data in SQL

I have data as below, which is partial and few rows are missing. I need an average with data considering the previous available value. Do we have any function available for such an average in sql?  Needed average: 220  Available data for 10…
Anu
  • 176
  • 1
  • 3
  • 14
0
votes
1 answer

Python: how to properly use rolling mean in a loop with Pandas?

I have a dataframe df containing the information of the transaction between 2 companies and the time. I have to group-by every 3 months and make a comparison with other 3 months plus 1. For instance I have to group together October 2015, November…
emax
  • 6,965
  • 19
  • 74
  • 141
0
votes
1 answer

Python Pandas rolling mean DataFrame Constructor not properly called

I am trying to create a simple time-series, of different rolling types. One specific example, is a rolling mean of N periods using the Panda python package. I get the following error : ValueError: DataFrame constructor not properly called! Below is…
Kiann
  • 531
  • 1
  • 6
  • 20