0
0
ML Pythonprogramming~10 mins

Handling missing values in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check for missing values in the DataFrame.

ML Python
missing = df.isnull().[1]()
Drag options to blanks, or click blank then click option'
Amean
Bsum
Ccount
Dfillna
Attempts:
3 left
2fill in blank
medium

Complete the code to fill missing values with the mean of the column.

ML Python
df['age'] = df['age'].[1](df['age'].mean())
Drag options to blanks, or click blank then click option'
Afillna
Bisnull
Creplace
Ddropna
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to drop rows with any missing values.

ML Python
cleaned_df = df.[1](axis=0, how='any')
Drag options to blanks, or click blank then click option'
Afillna
Bisnull
Creplace
Ddropna
Attempts:
3 left
4fill in blank
hard

Fill both blanks to create a new DataFrame with missing values replaced by the median.

ML Python
df_clean = df.[1](df.[2]())
Drag options to blanks, or click blank then click option'
Afillna
Bmean
Cmedian
Ddropna
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to create a dictionary of column means for filling missing values.

ML Python
fill_values = {col: df[col].[1]() for col in df.columns if df[col].[2]().any()}
df_filled = df.[3](fill_values)
Drag options to blanks, or click blank then click option'
Amean
Bisnull
Cfillna
Ddropna
Attempts:
3 left