* 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 })
| 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. |
nothing calls this directly
no test coverage detected