codes = pd.DataFrame([
    {"participant": "P001", "quote": "I felt unheard by my provider", "theme": "communication"},
    {"participant": "P001", "quote": "appointments were hard to schedule", "theme": "access"},
    {"participant": "P002", "quote": "the doctor explained everything clearly", "theme": "communication"},
])

>>> codes.groupby("theme")["participant"].nunique()
theme
access           1
communication    2
