Replies: 5 comments 11 replies
-
Rolling window isn't based on a time period it's based on a number of records. See in this example from the guide: function computePctChange (window) {
const amountChange = window.last() - window.first(); // Compute amount of change.
const pctChange = (amountChange / window.first()) * 100; // Compute % change.
return pctChange;
}
const pctChangeSeries = series.rollingWindow(2).select(computePctChange); The 2 that's passed in here is only specifies the number of elements to include in each window, it doesn't mean 2 seconds, 2 hours, 2 days or anything like that. |
Beta Was this translation helpful? Give feedback.
-
Are you able to prep some working code for me to start from? Maybe in a git repo that includes the data? Happy to help just don't have much time to do the setup work. |
Beta Was this translation helpful? Give feedback.
-
Thanks, looks good. I'll try find time tomorrow to figure it out. |
Beta Was this translation helpful? Give feedback.
-
Hey, which is it the "premium" field in the data set that you are trying to sum up per hour? |
Beta Was this translation helpful? Give feedback.
-
Hi @skwasha, checkout what I've done with your code here: https://github.com/ashleydavis/data-forge-windows I used Let me know how it looks. |
Beta Was this translation helpful? Give feedback.
-
I have a set of data (a list of orders received throughout the day). Each of the orders is timestamped but they are not evenly spaced out. E.g., there might be two in 10 minutes and then none for another 30 min, etc. I need to add a column to each order/row that is a sum of another column from the previous orders within the last X hours.
I can't use a normal rolling window (unless I'm missing something) because the period in this case is time based and not a simple count. As I understand it, a variable window would simply split my data into distinct windows and I wouldn't get the "rolling" aspect.
Any help appreciated.
Beta Was this translation helpful? Give feedback.
All reactions