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

Method std

src/danfojs-base/core/frame.ts:1020–1039  ·  view source on GitHub ↗

* Return standard deviation of values in a DataFrame across specified axis. * @param options.axis 0 or 1. If 0, compute the standard deviation column-wise, if 1, row-wise. Defaults to 1 * @example * ``` * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']}) * d

(options?: { axis?: 0 | 1 })

Source from the content-addressed store, hash-verified

1018 * ```
1019 */
1020 std(options?: { axis?: 0 | 1 }): Series {
1021 const { axis } = { axis: 1, ...options }
1022
1023 if (this.$frameIsNotCompactibleForArithmeticOperation()) {
1024 throw Error("TypeError: std operation is not supported for string dtypes");
1025 }
1026
1027 if ([0, 1].indexOf(axis) === -1) {
1028 throw Error("ParamError: Axis must be 0 or 1");
1029 }
1030
1031 const newData = this.$getDataByAxisWithMissingValuesRemoved(axis)
1032 const resultArr = newData.map(arr => std(arr))
1033 if (axis === 0) {
1034 return new Series(resultArr, { index: this.columns });
1035 } else {
1036 return new Series(resultArr, { index: this.index });
1037 }
1038
1039 }
1040
1041 /**
1042 * Return variance of values in a DataFrame across specified axis.

Callers

nothing calls this directly

Calls 4

indexOfMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected