Look up a number inside a list within a pandas cell, and return corresponding string value from a second DF
I created my own data.

train.csv

id,attrib
1,1 2 3
2,3 4 5
3,2 3 5
4,1 1 1


labels.csv

attrib_id,attrib_name
1,a
2,b
3,c
4,d
5,e


Read the csv files and create df1 and df2

After that use

def get_name(x):
    result = []
    for t in x.split(' '):
        result.append(df2[df2['attrib_id']==int(t)]['attrib_name'].values[0])
    return result

df1['attrib'] = df1['attrib'].apply(lambda x: get_name(x))



This will result in df1 looking like

 
I guess you also doing the same thing when you referred @Danny. The only thing important here is to convert the string into integer