Drop Missing Data
IntuitionFocus on identifying and removing rows with missing values in specific columns, ensuring data consistency while retaining other valid rows.Approach
Use
# **Intuition**  
Focus on identifying and removing rows with missing values in specific columns, ensuring data consistency while retaining other valid rows.



# **Approach**  
1. Use `dropna()` with the `subset` parameter to target rows with missing values in the specified column (e.g., `"name"`).  
2. Return the cleaned DataFrame with only valid entries.



# **Complexity**  
- **Time Complexity**: $$O(n)$$, where \(n\) is the number of rows in the DataFrame (as each row is scanned once).  
- **Space Complexity**: $$O(1)$$ if `inplace=True`; otherwise, $$O(n)$$ for creating a new DataFrame.

# Code
```pythondata []
import pandas as pd

def dropMissingData(students: pd.DataFrame) -> pd.DataFrame:
    # Drop rows with missing values in the "name" column
    clean_student = students.dropna(subset=["name"])
    return clean_student

# Sample data
data = {
    "student_id": [32, 217, 779, 849],
    "name": ["Piper", None, "Georgia", "Willow"],
    "age": [5, 19, 20, 14],
}

# Convert the data dictionary into a DataFrame
df = pd.DataFrame(data)

# Apply the function to remove rows with missing "name"
result = dropMissingData(df)

# Display the result
print(result)

```
['Pandas']