Skip to content
Advertisement

How to do left join with larger table, keeping left tables size?

I have a dataframe1:

JavaScript

and dataframe2:

JavaScript

i want to join type column to dataframe1 by id to get:

JavaScript

How could I do that? as you see output table is same shape as dataframe1? but when i use pd.merge output is larger

Advertisement

Answer

Try this:

JavaScript

Output:

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