datatable.rowsd()¶
For each row, find the standard deviation among the columns from cols
skipping missing values. If a row contains only the missing values,
this function will produce a missing value too.
Parameters¶
cols
FExpr
Input columns.
except
TypeError
The exception is raised when cols
has non-numeric columns.
Examples¶
from datatable import dt, f, rowsd
DT = dt.Frame({'name': ['A', 'B', 'C', 'D', 'E'],
'group': ['mn', 'mn', 'kl', 'kl', 'fh'],
'S1': [1, 4, 5, 6, 7],
'S2': [2, 3, 8, 5, 1],
'S3': [8, 5, 2, 5, 3]}
DT
name | group | S1 | S2 | S3 | ||
---|---|---|---|---|---|---|
str32 | str32 | int32 | int32 | int32 | ||
0 | A | mn | 1 | 2 | 8 | |
1 | B | mn | 4 | 3 | 5 | |
2 | C | kl | 5 | 8 | 2 | |
3 | D | kl | 6 | 5 | 5 | |
4 | E | fh | 7 | 1 | 3 |
Get the row standard deviation for all integer columns:
DT[:, rowsd(f[int])]
C0 | ||
---|---|---|
float64 | ||
0 | 3.78594 | |
1 | 1 | |
2 | 3 | |
3 | 0.57735 | |
4 | 3.05505 |
Get the row standard deviation for some columns:
DT[:, rowsd(f[2, 3])]
C0 | ||
---|---|---|
float64 | ||
0 | 0.707107 | |
1 | 0.707107 | |
2 | 2.12132 | |
3 | 0.707107 | |
4 | 4.24264 |
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.