The Statistics component creates ab array of statistics (Min, Max, Mean/Average, Median, Standard Deviation, Sum, Mode) of incoming multiple incoming values which will be available in the next component as cv.Statistics
. The cvPayload
is passed through as is.
If an incoming value is not a number, that value will be excluded from the statistics. The number of values that enter the statistics without being excluded will be output to the component variables as Count
.
Example:
cv.Payload [100 100 80 80 80 70 70 30 10 0]
cv.Statistics {"Average":62 "Count":10 "Max":100 "Mean":62 "Median":75 "Min":0 "Mode":[80] "StandardDeviation":34 "Sum":620}
To get statistics on sensor values in the SensorDataDB component, you can create statistics based on sensor data values by specifying the value expression property “cv.Payload.Data”.
The Capacity Component Property
The cp.Capacity
property allows you to “chunk” the incoming values into junks. If the value is set to 0
, all data will be considered as one set. But if you set capacity
to 2
for example, your input items will be “chunked” into values of 2.
Output Payload and Variable | Description |
---|---|
cv.Payload |
The output Payload of the component is the same as the input Payload |
cv.Statistics |
The component following the Statistics component will have a cv.Statistics component variable with the statistics information as below |
cv.Statistics.Average |
Average |
cv.Statistics.Count |
The number of values that entered the statistics without being excluded |
cv.Statistics.Max |
Max value |
cv.Statistics.Mean |
Mean |
cv.Statistics.Median |
Median |
cv.Statistics.Min |
Minimum value |
cv.Statistics.Mode |
Most Frequent value |
cv.Statistics.StandardDeviation |
Standard deviation |
cv.Statistics.Sum |
Total |
Need more help with this?
Join our slack community for help