it is necessary to create a column with the name according to their code. I have a dictionary, I'm trying to rename codes to titles. There are two conditions, because the code may not be in the dictionary, then you need to write the code, or if the code field is empty, then write the void.if there is only one code, everything works, if there are several codes, a problem arises
I tried to write a lambda function
missing_values = {}
dict_=dict_name
dict_fr=pd.DataFrame.from_dict(dict_name, orient='index')
dict_fr.index=dict_fr.index.map(str)
for_ag_pivot['name_cod']=for_ag_pivot['cod_last'].apply(lambda x: ",".join(dict_fr[0].loc[str(x).split(',')].tolist() if x in dict_name.keys() else x))