pandas || 2 lines groupby and filter || T/S  99% / 16%
\nimport pandas as pd\n\ndef find_classes(courses: pd.DataFrame) -> pd.DataFrame:\n\n    grp = courses.groupby(\'class\')[\'student\'].apply(len).reset_index()\
```\nimport pandas as pd\n\ndef find_classes(courses: pd.DataFrame) -> pd.DataFrame:\n\n    grp = courses.groupby(\'class\')[\'student\'].apply(len).reset_index()\n\n    return grp[grp.student >= 4].iloc[:,[0]]\n```\n[https://leetcode.com/problems/classes-more-than-5-students/submissions/1257629512/](https://leetcode.com/problems/classes-more-than-5-students/submissions/1257629512/)\n\n\nI could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(*N*), in which *N* ~ `len(courses)`.
['Pandas']