Fill empty cells with VLOOKUP from other table

211 Views Asked by At

I have Agents table and Revenues table (see attached). On Agents table, I want to fill the marginal revenue empty cells (only empty!) with the equivalent vlookup value in Revenues table (Join, Merge et cet just wont work). Many thanks ! enter image description here

enter image description here

1

There are 1 best solutions below

0
Michael On

You don't really have any minimal, reproducible example, but this should just work. Assuming your are using pandas and the column name is actually 'Agent ID'.

import pandas as pd
new_df = pd.merge(agents_table_df, 
                  revenues_df, 
                  on ='Agent ID', 
                  how ='inner')`