I have two dataframes which are in this manner:
id Area Name
-------------------
1 A abc
2 B xyz
3 C hi
and
group id
-----------
a 1
a 3
b 2
c 1
c 3
And I want to add first table's information to the second table like below:
group id Area Name
---------------------------
a 1 A abc
a 3 C hi
b 2 B xyz
c 1 A abc
c 3 C hi
Now I'm using loop, but I want to know is there any effective way to solve this problem. Thank you :)
def find_meta(id, column):
info = left.iloc[id]
data = info[column]
return data
for column in left.columns:
right[column] = right['songs'].map(lambda x :find_meta(int(x),column))