datatable.sd()¶
Calculate the standard deviation for each column from cols
.
Parameters¶
cols
Expr
Input columns.
return
Expr
f-expression having one row, and the same names and number of columns
as in cols
. The column stypes are float32
for
float32
columns, and float64
for all the other numeric types.
except
TypeError
The exception is raised when one of the columns from cols
has a non-numeric type.
Examples¶
from datatable import dt, f
DT = dt.Frame(A = [0, 1, 2, 3], B = [0, 2, 4, 6])
DT
A | B | ||
---|---|---|---|
int32 | int32 | ||
0 | 0 | 0 | |
1 | 1 | 2 | |
2 | 2 | 4 | |
3 | 3 | 6 |
Get the standard deviation of column A:
DT[:, dt.sd(f.A)]
A | ||
---|---|---|
float64 | ||
0 | 1.29099 |
Get the standard deviation of columns A and B:
DT[:, dt.sd([f.A, f.B])]
A | B | ||
---|---|---|---|
float64 | float64 | ||
0 | 1.29099 | 2.58199 |
The content on this page is licensed under the Creative Commons Attribution 4.0 License
(CC BY 4.0) ,
and code samples are licensed under the MIT License.