How to compare two dataframe and fill the column value based on condition?

  dataframe, pandas, python, python-3.x

Hi I am trying to compare two dataframe based on some condition and trying to fill the column value. I am not getting desirable result. Could you please help me?

Example:

df1:

PDF_FILE_Name                                         Indication
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_rfa_rec      
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_rfa_cgr
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_fdk_pfizer
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_fdk_kcc


df2:

PDF_FILE_Name                                         Indication
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_rfa_rec      Metastatic Renal Cell Carcinoma  
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_fdk_pfizer   Metastatic Renal Cell Carcinoma

In result I want below df
print(df1):

PDF_FILE_Name                                         Indication
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_rfa_rec      Metastatic Renal Cell Carcinoma  
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_rfa_cgr
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_fdk_pfizer   Metastatic Renal Cell Carcinoma
PA0001000_pcodr_rfa_axitinib_inlyta_mrcc_fdk_kcc

Source: Python-3x Questions

LEAVE A COMMENT