#NoPayJan Offer - Access all CloudxLab Courses for free between 1st to 31st JanEnroll Now >>
Now that we know that there are two missing values in the data, we have to fill those missing values.
Pandas provides some built-in methods to do this job.
bfill- used to backward fill or use the next valid observation to fill the missing values in the dataset.
ffill- used to forward fill or use the previous valid observation to fill the missing values in the dataset.
fillna(metohd='bfill')is another way of achieving the job using backward filling. Similarly, one could use
ffillor any other way like
Let us use
bfill() to fill the two missing values.
First let us see the number of missing values in each column in
print("Before filling missing values:\n", modified_df.<< your code comes here >>)
bfill method on
modified_df and put
modified_df = modified_df.<< your code comes here >>(axis ='rows')
Now, let us again check the column-wise null values in
modified_df. Now we expect all the values to be 0 as we have filled them.
print("\nAfter filling missing values:\n",modified_df.isna().sum())
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here