Recall & Review
beginner
What does the
dropna() function do in data analysis?The
dropna() function removes rows or columns that contain missing values (NaN) from a dataset, helping to clean the data for analysis.Click to reveal answer
beginner
How can you use
dropna() to remove columns with missing values instead of rows?You can use
dropna(axis=1) to remove columns that have any missing values instead of rows.Click to reveal answer
intermediate
What does the parameter
how='all' do in dropna()?The parameter
how='all' tells dropna() to drop only those rows or columns where all values are missing.Click to reveal answer
intermediate
What is the effect of
dropna(thresh=2) on a DataFrame?It keeps only rows or columns with at least 2 non-missing values, dropping those with fewer than 2 valid entries.
Click to reveal answer
beginner
Why is it important to drop missing values before analysis?
Missing values can cause errors or misleading results in calculations and models, so dropping them helps ensure accurate and reliable analysis.
Click to reveal answer
What does
df.dropna() do by default?✗ Incorrect
dropna() removes rows that have at least one missing value by default.How do you drop columns with missing values using
dropna()?✗ Incorrect
Setting
axis=1 tells dropna() to drop columns instead of rows.What does
dropna(how='all') do?✗ Incorrect
The
how='all' option drops only rows or columns where every value is missing.What does the
thresh parameter control in dropna()?✗ Incorrect
thresh sets the minimum count of non-NaN values needed to keep a row or column.Why might you choose to drop missing values instead of filling them?
✗ Incorrect
Dropping missing values avoids adding potentially wrong data that could bias results.
Explain how to use
dropna() to clean a dataset by removing rows or columns with missing values.Think about the axis and how parameters.
You got /4 concepts.
Describe why handling missing data is important before doing data analysis.
Consider the impact of missing values on results.
You got /4 concepts.