Which is better, replacement by mean and replacement by median? I'm doing a project that involves replacing missing values in a set of data (first time doing this). This involves using two methods replacement by mean and replacement by median to fill in the missing values. There is not a lot of difference between the results of the minimum, median, maximum, mean and standard deviation of the data using both methods and I was wondering which method is better and how can I make a decision to which one is better using the results produced?
 A: Imputation is a means to a goal, not the goal in itself. In some circumstances, replacing missing data might be the wrong thing to do. Make sure that you first pay attention to why your data are missing, as explained for example in the Missing data Wikipedia page, and that imputation is actually appropriate for answering the question your project seeks to answer. 
If some assumptions are met (for example, if the probability of a variable having a missing value does not depend on the value itself, technically called "missing at random") and your study involves multiple variables, you might be better off using multiple imputation rather than replacements by means or medians. In multiple imputation, known values of all variables are used to provide several sets of estimates of the missing data. This approach can provide better estimates both of the underlying relations among the variables and of the reliability of your estimates. See questions on this site having the multiple-imputation tag for more information.
A: It always depends on your data and your task.
If there is a dataset that have great outliers, I'll prefer median. E.x.: 99% of household income is below 100, and 1% is above 500.
On the other hand, if we work with wear of clothes that customers give to dry-cleaner (assuming that dry-cleaners' operators fill this field intuitively), I'll fill missings with mean value of wear. 
It is better to start from data understanding and then this article will be helpful starting point.
A: Imputing with the median is more robust than imputing with the mean, because it mitigates the effect of outliers. In practice though, both have comparable imputation results.
However, these two methods do not take into account potential dependencies between columns, which may contain relevant information to estimate missing values. More sophisticated algorithms like MissForest or MICE (both instances of the Iterative Imputer) or the kNNImputer provide much better imputation quality when mesured with the imputation RMSE. Here is a banchmark for data imputation methods: https://www.frontiersin.org/articles/10.3389/fdata.2021.693674/full
You can also find a nice introduction to these methods with ScikitLearn in Python here:
https://scikit-learn.org/stable/modules/impute.html
