MCPcopy Index your code
hub / github.com/javascriptdata/danfojs / mean

Method mean

src/danfojs-base/core/series.ts:493–496  ·  view source on GitHub ↗

* Returns the mean of elements in Series. * @example * ``` * const sf = new Series([1, 2, 3, 4, 5, 6]); * console.log(sf.mean()); * //output 3.5 * ```

()

Source from the content-addressed store, hash-verified

491 * ```
492 */
493 mean(): number {
494 const values = this.$checkAndCleanValues(this.values as ArrayType1D, "mean")
495 return (values.reduce((a, b) => a + b) / values.length) as number
496 }
497
498
499 /**

Callers 1

describeMethod · 0.95

Calls 1

$checkAndCleanValuesMethod · 0.95

Tested by 1

describeMethod · 0.76