I have two dataframes which I would like to append based on a regex. If the value in a 'code' column of df1 matches (eg. R93) with the 'ICD_CODE' of df2(eg. R93), append the 'code' column value to df2.
df1
code
R93.2
S03
df2
ICD_CODE ICD_term MDR_code MDR_term
R93.1 Acute abdomen 10000647 Acute abdomen
K62.4 Stenosis of anus and rectum 10002581 Anorectal stenosis
S03.1 Hand-Schüller-Christian disease 10053135 Hand-Schueller-Christian disease
The expected output is:
code ICD_CODE ICD_term MDR_code MDR_term
R93.2 R93.1 Acute abdomen 10000647 Acute abdomen
S03 S03.1 Hand-Schüller-Christian disease 10053135 Hand-Schueller-Christian disease
Any help is highly appreciated!