I have a data frame df
as below and I want to count how many scores are greater than 10 in df
score column.
data in dataframe df
is like :
code score
A 11
B 9
c 14
D 11
and as output I want 3.
I have a data frame df
as below and I want to count how many scores are greater than 10 in df
score column.
data in dataframe df
is like :
code score
A 11
B 9
c 14
D 11
and as output I want 3.
Use sum
of boolean mask - count True
s values like 1
s:
out = df['score'].gt(10).sum()
#or
#out = (df['score'] > 10).sum()
print (out)
3