Computer scienceData scienceInstrumentsPandasData preprocessing with pandas

Working with missing values

Count NaNs

Report a typo

You are going to practice on data containing information about students. It has three columns: year is a student's year of study, degree is their degree, and age is their age. You must do the following:

  1. Load the data as a pandas DataFrame.

  2. Count the number of missing values per column using .isnull() and .sum() methods.

  3. Print the result and make sure that it is in the format shown in the example

  4. Copy the result to the answer section.

Sample Input 1:

year,degree,age
3,M,18
NaN,B,18
2,M,21
NaN,B,19
NaN,B,19
2,NaN,29
1,NaN,28
3,M,29
1,M,28
3,NaN,18
1,NaN,27
2,M,25
2,M,20
1,B,20
3,B,23

Sample Output 1:

year      3
degree    4
age       0
dtype: int64
Write code in your IDE to process the text file and display the results below
___

Create a free account to access the full topic