1.

How will you identify and deal with missing values in a dataframe?

Answer»

We can identify if a DATAFRAME has missing values by using the isnull() and isna() methods.

missing_data_count=DF.isnull().sum()

We can handle missing values by EITHER replacing the values in the column with 0 as follows:

df[‘column_name’].fillna(0)

Or by replacing it with the MEAN VALUE of the column

df[‘column_name’] = df[‘column_name’].fillna((df[‘column_name’].mean()))


Discussion

No Comment Found