# combine two features into one [closed]

In an epidemic disease dataset of 3 months, I have a feature (var dt_died) with the death dates of patients (800 people died out of all 12k unique subjects in this dataset, so obviously only dead subjects have data for this feature).

I also have a feature that indicates the (var dt_test_positive) date of testing positive for the disease (with no missing values).

I would like to combine these two features into one (var difference). If I just make the difference for all dead people and just put zero in all other people with no dead flag, the person who just tested positive at the end of the third month and who not survived after 3rd month still have no flag for died or not, but has same value ZERO as other survived people.

May I know any proper way to create a variable to incorporate the two variables I mentioned above as a single one?

Edit: I have other 300 plus features and would like to include these two features as one. This is not a target variable. I have another variable with the outcome (died or not) and I am trying to predict mortality.

• Hi, please don't delete your existing question, it's better to ask a new question: new questions are more likely to be seen by contributors. When you ask a new question please try to explain clearly what you want to do. Jun 12 at 22:47

## 1 Answer

It seems that your target variable (died or not) is also a feature (dt_died) so the problem is ill defined. Essentialy any ML algorithm would predict 'died' when it encounters a missing value in dt_died.

• I would like to include the feature "difference". So Is it okay to keep zero for people who not died?
– DOT
Jan 5 at 21:02