datatable.rowcount()¶
For each row, count the number of non-missing values in cols
.
Parameters¶
cols
FExpr
Input columns.
return
FExpr
f-expression consisting of one int32
column and the same number
of rows as in cols
.
Examples¶
from datatable import dt, f
DT = dt.Frame({"A": [1, 1, 2, 1, 2],
"B": [None, 2, 3, 4, None],
"C":[True, False, False, True, True]})
DT
A | B | C | ||
---|---|---|---|---|
int32 | int32 | bool8 | ||
0 | 1 | NA | 1 | |
1 | 1 | 2 | 0 | |
2 | 2 | 3 | 0 | |
3 | 1 | 4 | 1 | |
4 | 2 | NA | 1 |
Note the exclusion of null values in the count:
DT[:, dt.rowcount(f[:])]
C0 | ||
---|---|---|
int32 | ||
0 | 2 | |
1 | 3 | |
2 | 3 | |
3 | 3 | |
4 | 2 |
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.