How to handle sparsely coded features in a dataframe
The first question you have to answer is whether these are actually missing or simply sparsely coded!
E.g. if the variables are &quot;supposed&quot; to only show doctors recommended diet, insulin or lifestyle change then we could naturally conclude that any NaN is actually a &quot;No&quot; in which case you do not even have to impute the data but rather straight-up replace with &quot;yes = 1 and NaN = 0.
How do you differentiate this case (sparsely coded) from the other case: actual missing values? Besides applying your domain knowledge you should also test whether the following rules apply:

If diabetes == No then all treatment variables are missing
If diabtes == Yes then at least one treatment variable is &quot;Yes&quot;
Treatment variables are always only &quot;Yes&quot; or NaN

If this is the case your dataset is likely sparsely coded, otherwise you have actual missing values.
Take note however that should the values be actual missing values (e.g. because you identify some cases where non-diabetics have a treatment or some cases are labeled &quot;No&quot; in the treatment variables) you can assume they are MAR but not MNAR. In this case I would recommend to remove these variables because imputation as &quot;No&quot; or o does not make sense if you do not have any information what the NaN actually means.