Scores
comorbidity(score=..., ...) calculates one of the scores below. score is case-insensitive; the result has one row per id_col with the score in the column named in the table.
score |
Aliases | Output column | Default implementation |
Default weights |
|---|---|---|---|---|
charlson |
cci, charlsoncomorbidityindex, charlson_comorbidity_index |
Charlson Age-Comorbidity Score |
quan |
charlson |
elixhauser |
eci, elixhausercomorbidityindex, elixhauser_comorbidity_index |
Elixhauser Comorbidity Index |
quan |
van_walraven |
combined |
ccs, gagne, combinedcomorbidityscore, combined_comorbidity_score |
Combined Comorbidity Score |
none | none |
hfrs |
hospitalfrailtyriskscore, hospital_frailty_risk_score |
HFRS Score |
none | none |
custom |
customcomorbidityindex |
score_col_name (default Custom Comorbidity Score) |
none | none |
Options shared by all scores:
| Argument | Default | Meaning |
|---|---|---|
id_col, code_col |
"id", "code" |
Patient identifier and ICD code columns (one row per patient and code) |
age_col |
"age" |
Age in years. Required for charlson only |
year_col |
"year" |
Year of the code. Required for the year-specific implementations below and for ICD modification |
icd_version |
"icd10" |
"icd9", "icd10" or "icd9_10" (the latter needs icd_version_col with the values "ICD-9" / "ICD-10" per row) |
return_categories |
False |
Also return one 0/1 column per category (and Age Score for Charlson) |
If the chosen implementation covers only one ICD version, icd_version is switched to it with a UserWarning. Full citations are in References.
Charlson Comorbidity Index
Score = sum of category weights + age points. The original index is Charlson 1987 (see also Charlson 1994). Age points are 0 (<50), 1 (50–59), 2 (60–69), 3 (70–79), 4 (≥80) and are added for weights="charlson" only. schneeweiss, quan, rcs and uk_shmi define no age points; the implementations (code lists) never define age points themselves. A patient's age is the highest value in their rows; a missing age gives 0 points.
Hierarchy: diabetes with chronic complication replaces diabetes without, moderate or severe liver disease replaces mild liver disease, and metastatic solid tumor replaces any malignancy.
implementation
| Value | Reference | ICD | Notes |
|---|---|---|---|
quan (default) |
Quan 2005 | ICD‑9‑CM, ICD‑10 | |
deyo |
Deyo 1992 | ICD‑9‑CM | |
romano |
Romano 1993 | ICD‑9‑CM | Codes as in the revision of the paper; no rheumatic disease or AIDS codes in the original table |
dhoore |
D'Hoore 1996 | ICD‑9‑CM | |
australia |
Sundararajan 2004 | ICD‑10‑AM | Categories renamed (e.g. Cancer, HIV) |
thygesen |
Thygesen 2011 | ICD‑10 | Denmark; Any tumor, Leukemia, Lymphoma kept separate |
sweden |
Ludvigsson 2021 | ICD‑9, ICD‑10 | Swedish ICD-9; pulmonary disease split in two categories |
rcs |
Armitage 2010 | ICD‑10 | Always RCS weights; no peptic ulcer; liver disease and diabetes not split by severity |
uk_shmi |
NHS Digital 2026 | ICD‑10 | Version 1.60 (June 2026). Always SHMI weights |
sokolowski |
Sokołowski 2026 | ICD‑10‑GM | Germany; year-specific, requires year_col |
weights
| Value | Reference | Notes |
|---|---|---|
charlson (default) |
Charlson 1987 | |
schneeweiss |
Schneeweiss 2003 | No age points |
quan |
Quan 2011 | No age points |
rcs |
Armitage 2010 | Every category counts 1; no age points |
uk_shmi |
NHS Digital 2026 | Negative totals are set to 0 |
rcs and uk_shmi implementations always use their own weights; another weights value is replaced with a UserWarning.
Elixhauser Comorbidity Index
Score = sum of category weights (no age). The original index is Elixhauser 1998.
Hierarchy: complicated replaces uncomplicated diabetes and hypertension, and metastatic cancer replaces solid tumor without metastasis. ahrq_icd10 adds severity tiers for liver disease and renal failure and an in-situ tumor tier.
implementation
| Value | Reference | ICD | Notes |
|---|---|---|---|
quan (default) |
Quan 2005 | ICD‑9‑CM, ICD‑10 | |
elixhauser |
Elixhauser 1998 | ICD‑9‑CM | |
ahrq_icd9 |
AHRQ v3.7 | ICD‑9‑CM | No cardiac arrhythmias. Always AHRQ weights |
ahrq_icd10 |
AHRQ Refined v2026.1 | ICD‑10‑CM | Year-specific, requires year_col. Always AHRQ weights. Different category set: no cardiac arrhythmias or fluid and electrolyte disorders; adds e.g. dementia, leukemia, seizures and epilepsy |
weights
| Value | Reference | Notes |
|---|---|---|
van_walraven (default) |
van Walraven 2009 | |
thompson_30 |
Thompson 2015 | |
thompson_29 |
Thompson 2015 | |
swiss |
Sharma 2021 | |
ahrq |
Moore 2017 (ICD-9-CM), AHRQ Refined v2026.1 (ICD-10-CM) | Picked by icd_version; ahrq_icd9 / ahrq_icd10 enforce it |
The ahrq_icd9 / ahrq_icd10 implementations also replace any other weights value with a UserWarning. weights="ahrq" does not work with icd_version="icd9_10" (ValueError).
Combined Comorbidity Score
20 categories, no implementation or weights options. icd_version selects the mapping:
icd_version |
Reference | Notes |
|---|---|---|
icd9 |
Gagne 2011 | Charlson conditions after Romano 1993, Elixhauser conditions after Quan 2005 |
icd10 |
Sun 2017 | ICD‑10‑CM |
Weights are those of Gagne 2011.
Hospital Frailty Risk Score
ICD-10 only; no implementation or weights options. Mapping and weights from Gilbert 2018 (supplementary appendix).
Category lists
The category names of every variant are listed in the README and are returned as column names with return_categories=True. For the exact codes and weights behind any variant, use comorbidity_reporting.