I have two data frames, df_metadata and df_categories with a "y" column of numerical values corresponding to class labels. The df_categories also has a "name" column corresponding to the true name of the "y" label i.e. cat/dog...etc I am trying to create a new column in df_metadata called "name" which maps "y" values to the actual name.
Example
df_metadata:
i y
0 1
1 4
2 2
3 1
df_categories:
i loc name
0 1 dog
1 2 cat
2 3 fish
3 4 elephant
.
.
.
Desired output
df_metadata:
i y name
0 1 dog
1 4 elephant
2 2 cat
3 1 dog
Hope this is clear :)