2883. Drop Missing Data (Pandas)
Intuition\nConcise Filtering: Efficiently remove rows with missing values in the name column using a single boolean expression for streamlined data cleaning.\nL
# Intuition\nConcise Filtering: Efficiently remove rows with missing values in the name column using a single boolean expression for streamlined data cleaning.\nLeverage notnull(): Utilize the notnull() method to directly identify and filter non-null values for a focused approach.\n\n\n# Approach\nFilter with notnull():\nApply the boolean expression students[\'name\'].notnull() to create a boolean mask that identifies rows where the name column has non-null values.\nUse this boolean mask to directly filter the DataFrame, keeping only the rows where the condition is True.\nReturn Filtered DataFrame: Return the resulting DataFrame containing only rows with non-null values in the name column.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nimport pandas as pd\n\n\ndef dropMissingData(students: pd.DataFrame) -> pd.DataFrame:\n    return students[students[\'name\'].notnull()]\n```
['Pandas']