I have a script which uses system.tag.queryTagHistory to retrieve log data in 15 minute intervals for the previous 24 hours. I run it three times, and get a minimum dataset, a maximum dataset, and an average dataset. Now, I want to find the lowest value in the minimum dataset, the highest value in the maximum dataset, and the average value of all values in the average dataset.
In expression language, I can do this easily, but I don’t believe it’s possible to use expression language in a script.
I know python has min() and max() functions that operate on arrays, so I figure I should be able to pass the dataset values into those functions somehow. I can make it work with a brute force “for row in range()” and append each value to an array, but I figure there must be a more elegant way to do it. Or, a more elegant way to approach the problem altogether.
The system.math.mean() averaging method didn’t work; it gave me the error “(1st arg cannot be coerced to double)”. pturmel’s method works, though if you have an ideas as to why the system.math.mean doesn’t I’m interested to hear it - it’s certainly a more readable solution if I can make it work!
I’m trying to use this method, but I am getting an error in line 5. I’m taking a dataset and creating a new one with identical headers but with only one row which contains the average of each column in the previous dataset.
TypeError: mean(): 1st arg can't be coerced to double[]