✅ Simple Pandas - String Method .contains()
Intuition\n Describe your first thoughts on how to solve this problem. \nSimply filtering by using the string method .contains() and pass in the regex pattern.\
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSimply filtering by using the string method .contains() and pass in the regex pattern.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimport pandas as pd\n\ndef find_patients(patients: pd.DataFrame) -> pd.DataFrame:\n    # Regex pattern \n    # The \\b in the pattern is a word boundary assertion that ensures \'DIAB1\' is a separate word and not part of another word\n    # wildcard both in front and after according to the example\n    filtered = patients[patients[\'conditions\'].str.contains(r\'\\bDIAB1\')]\n    return filtered\n```
['Pandas']