Skip to content Skip to sidebar Skip to footer

Python Pandas, Build A Dataframe From 2 Dataframes With These Properties

i'm in need to solve this issue. I need to build a whole dataframe from two dataframes, but include only certain info from a second Dataframe if required. EXAMPLE: DF1: MATERIA

Solution 1:

You need merge with parameter left

df1.merge(df2, how = 'left')

    MATERIAL N° Description DATE DUE    BG GROUP    TRANSIT TIME
0   123123300   Lightbulb X 01/05/2018  9001.0      45D
1   220466      Lightbulb Y 04/04/2018  9002.0      30D
2   220000      Lightbulb Z 07/07/2018  9004.0      30D
3   1241241     Lightbulb A 02/01/2019  9002.0      40D
4   7775447     Lightbulb B 02/01/2019  NaN         NaN

Post a Comment for "Python Pandas, Build A Dataframe From 2 Dataframes With These Properties"