Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

merge three dataframes pandas based on column

# Merging 3 or more dataframes base on a common column
import pandas as pd
from functools import reduce

#Create a list of df to combine
list_of_df = [df_1,df_2,df_3]

#merge them together
df_combined = reduce(lambda left,right: pd.merge(left,right,on='common column'), list_of_df)
Source by datacarpentry.org #
 
PREVIOUS NEXT
Tagged: #merge #dataframes #pandas #based #column
ADD COMMENT
Topic
Name
7+8 =