🔥💯[Pandas] 2 Liner (Easy to understand)💯🔥
\n# Approach\n Describe your approach to solving the problem. \n- Group the DataFrame by class using the groupby function.\n- Count the number of students in ea
\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Group the DataFrame by class using the groupby function.\n- Count the number of students in each class by using the count function on the grouped DataFrame and resetting the index.\n- Filter the class_counts DataFrame to include only the rows where the student count is greater than or equal to five.\n- Return the resulting DataFrame containing the classes with at least five students.\n# Code\n```\nimport pandas as pd\n\ndef find_classes(courses: pd.DataFrame) -> pd.DataFrame:\n    # Group by class and count the number of students in each class\n    class_counts = courses.groupby(\'class\')[\'student\'].count().reset_index()\n    \n    # Filter classes with at least five students\n    result = class_counts[class_counts[\'student\'] >= 5][["class"]]\n    \n    return result\n```\n![upvote img.jpg](https://assets.leetcode.com/users/images/4be8f8e0-263e-4a69-8cd9-f89b75c468a8_1691842427.9345431.jpeg)\n
['Pandas']