Skip to content
Advertisement

Python Pandas Dataframe enrichment (from another)

I would like to enrich a dataframe (df1) from another(df2) by adding a new column in df1 and enriching it based on what I find in df2. The size of the 2 df is different as well as the name of the columns. I would like to do like a Vlookup function in Excel.

This what I’ve done but I think there is a way to optimize it :

JavaScript

Thanks for your help !

JaNa

Advertisement

Answer

Without a sample it’s hard to help but vlookup can be implemented like that:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement