Jump to content

Aggregate over variable size windows


Michele Scarpa

Recommended Posts

Hello, 

I have a dataset that reports the number of hours worked per day and the number of events occurred that day. 

I would like to aggregate data over the last 100 worked hours so I need a previous node function that check a condition:

day worked hours events avg per 100 h
1 36 1  
2 48 0  
3 19 0  
4 26 1  
5 42 2 3
6 34 1 4
7 22 0 3
8 45 1 2
9 50 2 3
10 52 1 3

 

a function similar to pandas.rolling (https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.rolling.html)

Is there any way to do this in spotfire?

Thanks

Link to comment
Share on other sites

Hi Michele, 

Since you have already identified the Python function that suits your needs, why not create a Python Data Function in Spotfire that returns this rolling average as an additional column in your data table?

Thanks,
Alain

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...