I have a pandas data frame below like this need to convert list of int elements from input to output elements using pandas
CodePudding user response:
Try with create the mapping dict
d = {0:'family', 1:'relatives' , 2:'neighbours', 3:'firends'}
df['output'] = pd.Series([list(map(d.get, l)) for l in df['input']])