Could someone help me with a wee task I'm stuck with.
I have a df with data (let's call it X) that is as numeric values, which I need to replace with labels. For that I have another df which act as a datamap (let's call it Y), so I actually need to grab a value from X, look it up on Y, to obtain the label that will go into X.
X:
Age Gender Region
1 2 1
2 2 3
2 1 1
Y:
Question Value Label
Age 1 18 to 45
Age 2 Over 45
Gender 1 male
Gender 2 female
Region 1 England
Region 2 Scotland
Region 3 Wales
What I would be looking to obtain is
Z:
Age Gender Region
18 to 45 - female - England
over 45 - female - Wales
over 45 - male - England
Of course my data frames are much bigger, X has like 246 columns and Y has 8k rows and 29 columns. Could you guys give me a hand on how to do such a replacement?
Thanks