Maybe you could convert your excel file 2 to some form of key value pair and then replace the primary diagnostics column in file 1 with the corresponding disease name, later apply some form of encoding like one-hot or something similar to file 1. Not sure if this approach would definitely help, but just sharing my thoughts.
I'm currently trying to use a number of medical codes to find out if a person has a certain disease and would require help as I tried searching for a couple of days but couldn't find any. Hoping someone can help me with this. Considering I've imported excel file 1 into df1 and excel file 2 into df2, how do I use excel file 2 to identify what disease does the patients in excel file 1 have and indicate them with a header? Below is an example of what the data looks like. I'm currently using pandas Jupyter notebook for this.
Excel file 1:




Patient
Primary Diagnosis
Secondary Diagnosis
Secondary Diagnosis 2
Secondary Diagnosis 3





Alex
50322
50111





John
50331
60874
50226
74444



Peter
50226
74444





Peter
50233
88888







Excel File 2:




Primary Diagnosis
Medical Code




Diabetes Type 2
50322


Diabetes Type 2
50331


Diabetes Type 2
50233


Cardiovescular Disease
50226


Hypertension
50111


AIDS
60874


HIV
74444


HIV
88888




Intended output:




Patient
Positive for Diabetes Type 2
Positive for Cardiovascular Disease
Positive for Hypertension
Positive for AIDS
Positive for HIV




Alex
1
1
0
0
0


John
1
1
0
1
1


Peter
1
1
0
0
1
How do i use medical codes to determine what disease a person have using jupyter?