0

I have a dataframe df

name level index
apple a 100.178
apple b 84.075
apple c 78.585
apple d 94.936
orange a 104.707
orange b 109.452
orange c 115.746
orange d 117.172

I want to map the index column based on level column values in df2 which has only id and name1 column initially this way:-

id name1 a_index b_index c_index d_index
1 apple 100.178 84.075 78.585 94.936
2 apple 100.178 84.075 78.585 94.936
3 orange 104.707 109.452 115.746 117.172
4 apple 100.178 84.075 78.585 94.936
Scope
  • 727
  • 4
  • 15

0 Answers0