func (q Query) Average() (avg float64, err error) {
	if q.err != nil {
		err = q.err
		return
	}
	if len(q.values) == 0 {
		return 0, ErrEmptySequence
	}
	sum, err := sumMixed(q.values)
	if err != nil {
		return
	}
	avg = sum / float64(len(q.values))
	return
}
// Average computes average of numeric values in the original sequence.
// See golang spec for numeric types. If sequence has non-numeric types or nil,
// ErrNan is returned. If original sequence is empty, ErrEmptySequence is
// returned.
//
// This method has a poor performance due to language limitations.
// On every element, type assertion is made to find the correct type of the
// element.
//
// Example:
//	mixedArr = {}interface[]{1, int8(2), uint(3), float64(4.4)}
//	avg, err := From(mixedArr).Average() // avg is 2.6
//	// or
//	avg, err := From([]int{1,2,3,4,5}).Average() // avg is 3.0
Average computes average of numeric values in the original sequence.
See golang spec for numeric types. If sequence has non-numeric types or nil,
ErrNan is returned. If original sequence is empty, ErrEmptySequence is
returned.

This method has a poor performance due to language limitations.
On every element, type assertion is made to find the correct type of the
element.


// Average computes average of numeric values in the original sequence . // See golang spec for numeric types . If sequence has non - numeric types or nil // ErrNan is returned . If original sequence is empty ErrEmptySequence is // returned . // // This method has a poor performance due to language limitations . // On every element type assertion is made to find the correct type of the // element . // // Example : // mixedArr = {} interface [] { 1 int8 ( 2 ) uint ( 3 ) float64 ( 4 . 4 ) } // avg err : = From ( mixedArr ) . Average () // avg is 2 . 6 // // or // avg err : = From ( [] int { 1 2 3 4 5 } ) . Average () // avg is 3 . 0
func (q Query) Average() (avg float64, err error) {
	if q.err != nil {
		err = q.err
		return
	}
	if len(q.values) == 0 {
		return 0, ErrEmptySequence
	}
	sum, err := sumMixed(q.values)
	if err != nil {
		return
	}
	avg = sum / float64(len(q.values))
	return
}
func ( q Query ) Average ( ) ( avg float64 , err error ) { if q . err != nil { err = q . err return } if len ( q . values ) == 0 { return 0 , ErrEmptySequence } sum , err := sumMixed ( q . values ) if err != nil { return } avg = sum / float64 ( len ( q . values ) ) return }
Average computes average of numeric values in the original sequence.
Average computes average of numeric values in the original sequence .