donné
patient_id test_result has_cancer
0 79452 Negative False
1 81667 Positive True
2 76297 Negative False
3 36593 Negative False
4 53717 Negative False
5 67134 Negative False
6 40436 Negative False
comment compter Faux ou Vrai dans une colonne, en python?
J'avais essayé:
# number of patients with cancer
number_of_patients_with_cancer= (df["has_cancer"]==True).count()
print(number_of_patients_with_cancer)
number_of_patients_with_cancer = df.has_cancer[df.has_cancer==True].count()