I have two dfs:- df1
and df2
.:-
dfs=[df1,df2]
df_final = reduce(lambda left,right: pd.merge(left,right,on='Serial_Nbr'), dfs)
I want to select only one column apart from the merge column Serial_Nbr
in df1
while doing the merge.
how do i do this..?
CodePudding user response:
Filter column in df1
:
dfs=[df1[['Serial_Nbr']],df2]
Or if only 2 DataFrames remove reduce
:
df_final = pd.merge(df1[['Serial_Nbr']], df2, on='Serial_Nbr')