Skip to content
Advertisement

Pandas to lookup and return corresponding values from many dataframes

A list of names and I want to retrieve each of the correspondent information in different data frames, to form a new dataframe.

I converted the list into a 1 column dataframe, then to look up its corresponding values in different dataframes.

The idea is visualized as:

enter image description here

I have tried:

JavaScript

But it returns the error message as:

JavaScript

I have also tried:

JavaScript

It works but it includes unnecessary columns.

What will be the smart an efficient way to do such, especially when the number of to-be-looked-up dataframes are many?

Thank you.

Advertisement

Answer

Filter only columns for merge and columns for append like:

JavaScript

If want working with list use this solution with filtering columns:

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