One line, no regex, pd.query solution
Code\n\nimport pandas as pd\n\ndef find_patients(patients: pd.DataFrame) -> pd.DataFrame:\n    return patients.query("conditions.str.startswith(r\'DIAB1\') or c
# Code\n```\nimport pandas as pd\n\ndef find_patients(patients: pd.DataFrame) -> pd.DataFrame:\n    return patients.query("conditions.str.startswith(r\'DIAB1\') or conditions.str.contains(r\' DIAB1\')")\n```
['Pandas']