0
0
Data Analysis Pythondata~10 mins

Dropping missing values (dropna) in Data Analysis 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 drop all rows with missing values from the DataFrame.

Data Analysis Python
cleaned_df = df.[1]()
Drag options to blanks, or click blank then click option'
Adropna
Bisnull
Cfillna
Dreplace
Attempts:
3 left
💡 Hint
Common Mistakes
Using fillna instead of dropna, which fills missing values instead of dropping rows.
Using isnull, which only checks for missing values but does not remove them.
2fill in blank
medium

Complete the code to drop columns with any missing values from the DataFrame.

Data Analysis Python
cleaned_df = df.dropna(axis=[1])
Drag options to blanks, or click blank then click option'
A0
B2
C1
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using axis=0 which drops rows instead of columns.
Using invalid axis values like 2 or -1.
3fill in blank
hard

Fix the error in the code to drop rows with missing values only if all columns are missing.

Data Analysis Python
cleaned_df = df.dropna(how='[1]')
Drag options to blanks, or click blank then click option'
Aall
Bany
Cnone
Dsome
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'any' which drops rows if any column is missing.
Using invalid strings like 'none' or 'some'.
4fill in blank
hard

Fill both blanks to drop rows with less than 3 non-missing values.

Data Analysis Python
cleaned_df = df.dropna(thresh=[1], axis=[2])
Drag options to blanks, or click blank then click option'
A3
B2
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using thresh less than 3 which keeps rows with fewer values.
Using axis=1 which drops columns instead of rows.
5fill in blank
hard

Fill all three blanks to drop columns with more than 2 missing values.

Data Analysis Python
df.dropna(thresh=[1], axis=[2], inplace=[3])
cleaned_df = df
Drag options to blanks, or click blank then click option'
Adf.shape[0] - 2
B1
CTrue
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using thresh as a fixed number instead of based on DataFrame shape.
Using axis=0 which drops rows instead of columns.
Setting inplace=False which does not modify original DataFrame.