0
0
Data Analysis Pythondata~5 mins

Identifying missing values (isnull, isna) in Data Analysis Python - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What do the functions isnull() and isna() do in pandas?
Both isnull() and isna() check for missing values in a DataFrame or Series. They return a new object of the same shape with True where the data is missing and False where it is present.
Click to reveal answer
beginner
How can you use isnull() to find how many missing values are in each column of a DataFrame?
You can call df.isnull().sum(). This returns a Series with the count of missing values for each column in the DataFrame df.
Click to reveal answer
beginner
Are isnull() and isna() different in pandas?
No, they are exactly the same. isna() is just an alias for isnull(). You can use either one to detect missing values.
Click to reveal answer
beginner
What type of values do isnull() and isna() detect as missing?
They detect NaN (Not a Number), None, and other null-like values as missing in pandas objects.
Click to reveal answer
intermediate
How would you filter rows in a DataFrame to keep only those with missing values in a specific column?
Use df[df['column_name'].isnull()]. This returns rows where the specified column has missing values.
Click to reveal answer
Which pandas function can you use to detect missing values in a DataFrame?
Adropna()
Bfillna()
Creplace()
Disnull()
What does df.isnull().sum() return?
ACount of missing values per column
BTotal number of missing values in the DataFrame
CRows with missing values
DDataFrame without missing values
Are isnull() and isna() different functions?
ANo, they are aliases and behave the same
BNo, but one is deprecated
CYes, one works only on Series
DYes, they detect different types of missing values
Which of these values is detected as missing by isnull()?
A"" (empty string)
BNaN
C0
DFalse
How to select rows where column 'Age' has missing values?
Adf[df['Age'].notnull()]
Bdf['Age'].fillna()
Cdf[df['Age'].isnull()]
Ddf.dropna(subset=['Age'])
Explain how to identify missing values in a pandas DataFrame using isnull() or isna().
Think about how to get a True/False map and then count Trues.
You got /3 concepts.
    Describe how to filter rows in a DataFrame to keep only those with missing data in a specific column.
    Focus on selecting rows where a column is missing.
    You got /2 concepts.