finding the average of the last maximum 20 values

i want to get the average temperature for thelast 20 years and compare it or find the dfference of that average with another column in another table (csv file)

Welcome to the forum @Omar_syd.

It’s unclear to me what you’re actually asking for.

In the title you say “finding the average of the last maximum 20 values.” What does that mean?

i want to get the average of the last 20 years and put in a single variabe

What does “the last 20 years” mean? What do you mean by “put in a single variable?”

If you’d like to to calculate a moving average of the values in the avg_temp column, with a window size of 20 rows, and display them in a new column, then the Moving Average node will work.

i wanna find the average temperature column three for the last 20 years ( so basically the sum of the last 20 values of the avg_temp/ 20 but always the maxmium 20 values for the year column.

Do a Groupby (Groupby node) of year with maximum value. Sort the data by year and limit to only top 20 results (Top K Selector node). Add a Constant Value Column node (append, not replace in the settings). Do another groupby on the constant value to get the average (mean).

I would use the Moving Aggregation node for this.

1 Like

i will give it a shot and tell you the feedback

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.