Complete the code to check for missing values in the DataFrame.
missing_counts = df.isnull().[1]()The sum() function counts the number of missing values (NaNs) in each column.
Complete the code to drop rows with any missing values.
clean_df = df.[1](axis=0, how='any')
The dropna() function removes rows or columns with missing values. Here, axis=0 means rows.
Fix the error in the code to fill missing values with the column mean.
df_filled = df.fillna(df.[1]())The mean() function calculates the average of each column, which is used to fill missing values.
Fill both blanks to create a dictionary for filling missing values: fill numeric columns with mean and categorical with 'Unknown'.
fill_values = {col: (df[col].[1]() if df[col].dtype == 'float64' else [2]) for col in df.columns}Numeric columns use mean() to fill missing values. Categorical columns are filled with the string 'Unknown'.
Fill all three blanks to create a new DataFrame with missing values filled: numeric columns with median, categorical with mode, and others with 'Missing'.
fill_map = {col: (df[col].[1]() if df[col].dtype == 'float64' else (df[col].[2]()[0] if df[col].dtype == 'object' else [3])) for col in df.columns}
df_filled = df.fillna(fill_map)Numeric columns use median(), categorical columns use the first value of mode(), and other types are filled with the string 'Missing'.