# Drop or impute the missing values?

I am working with a dataset having 45k rows and I was a bit confused on whether or not to drop the missing values OR impute the missing values.

Column wise missing value distribution :

As per this answer: https://stackoverflow.com/a/28199556/12298398), I calculated the number of rows containing missing values

>>> np.count_nonzero(df.isnull().values.ravel())
2057


But now I am a bit confused on whether or not I should drop these rows containing missing values since dropping them will cost a loss of data or I should impute those columns which have missing values greater than 500.

Let me know your thoughts on the same, Thank you

• Hi, This would depend on the task you are trying to solve with this dataset, could provide us with a bit more context, so we can give you more adapted answers ? Nov 26, 2021 at 9:23
• It is a part of the ongoing competition so I can't tell much about the problem. So that's why I asked in general what should be the approach but I get that it depends upon the problem so I'll try experimenting with it for this problem, Thank you Nov 27, 2021 at 8:48

2. Multivariate Imputation: As the name suggests, you use multiple columns to impute nan values in a specific feature/column. This method is the most preferred as it results in better imputation results than Univariate Imputation. Some of the most used techniques are KNNImputer and IterativeImputer. Again Google is your best friend!