Login using Social Account
     Continue with GoogleLogin using your credentials
Now that we know that there are two missing values in the data, we have to fill those missing values.
Note:
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 ffill
or any other way like mean()
.Let us use bfill()
to fill the two missing values.
First let us see the number of missing values in each column in modified_df
using isna().sum()
.
print("Before filling missing values:\n", modified_df.<< your code comes here >>)
Use bfill
method on modified_df
and put axis=rows
.
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())
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...