Untitled
modify above code like if eprm_table_type == 'RELEASE' the you have to construct filtered_df = df[df['eprm_catalog'].isin(['RELEASE']) & (df['eprm_enabled_flg'] == 'Y') after that you have to sort the eprm_seq_nbr which has values like numeric values you have to sort those columns in descending order like the highest number eprm_seq_nbr should execute first and after sorting execute the below query select * from table_name